Timelapse
Interactive record/replay for web apps
Brian Burg Andrew J. Ko Michael D. Ernst
Computer Science and Engineering University of Washington
Richard J. Bailey
1
Timelapse Interactive record/replay for web apps Richard J. Brian - - PowerPoint PPT Presentation
Timelapse Interactive record/replay for web apps Richard J. Brian Burg Andrew J. Ko Michael D. Ernst Bailey Computer Science and Engineering University of Washington 1 Its hard to debug failures in the field Distributed across
Brian Burg Andrew J. Ko Michael D. Ernst
Computer Science and Engineering University of Washington
Richard J. Bailey
1
2
Works for me..
“a piece doesn’t rotate properly!!” end-user encounters bug in production code files bug report with ad-hoc information developer unable to reproduce the bug 3
“What makes a good bug report”. Zimmerman et al. TSE Vol. 36, No 5 2010
“a piece doesn’t rotate properly!!” 4
Works for me..
“What makes a good bug report”. Zimmerman et al. TSE Vol. 36, No 5 2010
“a piece doesn’t rotate properly!!” 5
Works for me..
6
Selenium/ WebDriver CoScripter
Leshed et al, CHI 2008
Sikuli Script
Yeh et al, UIST 2009
Capture and simulate user input. Designed for test and task automation.
(CoScripter, Selenium, Sikuli)
(CoScripter, Selenium, Sikuli)
7
Capture and simulate user input. Designed for test and task automation.
(Mugshot, WaRR)
setup ahead of time. Can’t use with a debugger. Save and reuse nondeterministic inputs to exactly recreate a specific execution. Play/pause buttons only. Slows down execution. Can’t use with a debugger.
browsers
8
9
10
11
Output
Browser Input
(User, Network, Timers)
12
Web Interpreter
(WebKit, Gecko)
Output
13
Inputs Log
Web Interpreter
(WebKit, Gecko)
Browser Input
(User, Network, Timers)
Output
Inputs Log
14
Web Interpreter
(WebKit, Gecko)
User input, commands
policy decisions Date.now,
win.colorDepth
event loop callbacks
Web Interpreter
(WebKit, Gecko)
Platforms
15
Embedders
(Firefox, Safari, Chrome)
16
Embedders
(Firefox, Safari, Chrome)
Web Interpreter
(WebKit, Gecko)
Platforms
instructions
17
During normal execution, Date.now() returns the current time.
(c) { return “now:”+ Date.now(); } /* file: Source/wtf/DateMath.h */ inline double jsCurrentTime() { return floor(WTF::currentTimeMS()); }
18
Web Interpreter Platform API
Inputs Log
During recording, the return value of Date.now() is saved.
(c) { return “now:”+ Date.now(); } /* file: Source/wtf/DateMath.h */ inline double jsCurrentTime() { return floor(WTF::currentTimeMS()); }
19
Web Interpreter Platform API
On replay, the logged return value of Date.now() is used.
(c) { return “now:”+ Date.now(); } /* file: Source/wtf/DateMath.h */ inline double jsCurrentTime() { return floor(WTF::currentTimeMS()); }
Inputs Log
Web Interpreter Platform API
enqueue()
while (true) { var event = queue.pop(); this.dispatchToListeners(event); }
Event Loop
timerFired()
Callback executes Callback registered
Problem: accurately capturing and simulating event loop dispatches.
timer 42, 34 DOM events
enqueue() timerFired()
Callback executes Callback registered
while (true) { var event = queue.pop(); this.dispatch(event); }
Inputs Log
Event Loop
enqueue()
Callback registered
while (true) { var event = queue.pop(); this.dispatchToListeners(event); }
Event Loop
timerFired()
Callback executes
Inputs Log
34 DOM events! ... ... ...
0.2 0.4 0.6 0.8 1 1.2 1.4
Run times (multiple of baseline)
Baseline Recording 1× Replay Seeking
24
25
100 200 300 400 500 600 700 800 JSLinux JS Raytracer Space Invaders Mozilla.org CodeMirror Colorpicker DuckDuckGo Size (KB)
In-memory Serialized Compresse d
Site recording duration (s) resources
(KB) log growth (KB/sec) JSLinux 10.5 4500 0.8 JS Raytracer 6.3 5.9 1.6 Space Invaders 25.8 712 2.2 Mozilla.org 22.3 2800 1.3 CodeMirror 16.6 168 1.0 Colorpicker 15.3 577 1.7 DuckDuckGo 14.1 1900 2.1
26
500 1000 1500 2000 2500 3000 3500 4000 4500 5000 JSLinux JS Raytracer Space Invaders Mozilla.org CodeMirror Colorpicker DuckDuckGo Size (KB)
In-memory Serialized Compresse d
Site recording duration (s) resources
(KB) log growth (KB/sec) JSLinux 10.5 4500 0.8 JS Raytracer 6.3 5.9 1.6 Space Invaders 25.8 712 2.2 Mozilla.org 22.3 2800 1.3 CodeMirror 16.6 168 1.0 Colorpicker 15.3 577 1.7 DuckDuckGo 14.1 1900 2.1
27
20+ developers with industry experience within-subjects, 2 tasks per person, 45 minutes per task, 4 treatments
28
20+ developers with industry experience within-subjects, 2 tasks per person, 45 minutes per task, 4 treatments
Shorter and more frequent repro actions; Time spent unchanged (max. 25%;
avg.15%)
Successful developers quickly integrated replay into their existing workflows. Unsuccessful developers who used
distracted.
Interaction histories aid navigation, but not program understanding.
Precision and low overhead don’t matter if you forget to start capturing.
Developers can gather more runtime data without reproducing behavior: Post-hoc logging, Post-hoc Whyline, Post-hoc SeeSS, Testcase extraction
Interaction histories supported–but didn’t reduce–reproduction of program state.
Replay infrastructure enables new research, tools and workflows.
work well when applied to web applications.
Web interpreters expose a large and ever-changing API. Timelapse doesn’t tame all sources of nondeterminism (yet). Excepting untamed sources, the DOM tree and JavaScript heap are identical for all recorded and replayed executions. Possible divergence is automatically detected when:
Divergence detection supports piecewise implementation.
31
User: mouse, keyboard, scroll, resize Network: images, scripts, HTML, AJAX Commands: page navigation Internal nondeterminism: Animations, transitions, multimedia, async script and parser yields Functions: Date.now, Math.random, etc Caching: resources, cookies Timers: timer schedule
32
Shims are used to implement deterministic record/replay.
The hard part of implementing record/replay is designing and placing shims.
33
Embedder s
EMBEDDING API PLATFORM API
Web Interpreter
(WebKit, Gecko)
Abstraction layers separate web interpreters from platforms/embedders.
Platforms
34
Embedder s
EMBEDDING API PLATFORM API
Web Interpreter
(WebKit, Gecko)
Abstraction layers separate web interpreters from platforms/embedders.
Platforms
35
Embedder s
Web Interpreter
(WebKit, Gecko)
Platforms
EMBEDDING API PLATFORM API
Shims sit between the web interpreter and abstraction layers.
36
Embedder s
Web Interpreter
(WebKit, Gecko)
Platforms
EMBEDDING API PLATFORM API
Shims sit between the web interpreter and abstraction layers.
37