+ All Categories
Home > Documents > Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Date post: 16-Dec-2015
Category:
Upload: kory-simpson
View: 215 times
Download: 0 times
Share this document with a friend
31
Rivet: Browser- agnostic Remote Debugging for Web Applications James Mickens
Transcript
Page 1: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Rivet: Browser-agnostic Remote Debugging for Web Applications

James Mickens

Page 2: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

JAVASCRIPT IS HORRENDOUS

SO MANY BROWSERS

“MOBILE” IS A HATEFUL

ADJECTIVE

THE NETWORK SCOFFS AT MORTAL DREAMS

Web development is a miasma of pain and confusion.

Page 3: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Motivation: What Happens When Things Go Wrong?

Built-in IE debugger

Built-in FF debugger

Page 4: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

What’s the problem with current browser debuggers?

Can’t examine real bugs in the wild, only local ones! Tied to one browser!

Page 5: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

What You’d Like

A browser-agnostic remote debugger for web applications.

Page 6: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Worst dayever

Page 7: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Rivet: Remote Debugging for Web Apps

Page 8: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Awesome! Rivet lets you remotely debug

web pages!

Page 9: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

What’s the technical challenge?

Page 10: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

How do we pause a web page?

How do we interactively traverse

object graphs?

How do we make a WAN debugging

protocol efficient?

How do we implement breakpoints?

Page 11: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Pausing A Single Frame

Queued Events Event Loop

KeyPress

KeyPressCallback()

AjaxData

AjaxCallback()

MouseClick

ClickCallback()

Page 12: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Pausing A Single Frame

Event Loop

Queued Events

Key Press

RivetCallback()

MouseClick

ClickCallback()

MouseClick

ClickCallback()

Synchronous AJAX connection

Page 13: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Pausing a Multi-frame Web Page

Page 14: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

PAUSE REQ

llll

ACKll

llll

1 2

3 4

PAUSE REQ PAUSE REQ

ACK

Page 15: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

FROZEN

Page 16: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Inspecting Object Graphs• JavaScript has a powerful

reflection interface– An object is just a dictionary!– Globals are properties of special window object!

– Get f()’s source via f.toString()!

ll

Paused App IDEDebug serverI’m paused! Session ready!

Get globals.

Values of globals.

Expand X.Properties for X.

No session . . .Attached to remote page!

Name Value-------- --------+X object Y 42 Z “red”

Name Value-------- ---------X object foo false Y 42 Z “red”

Page 17: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

• All network traffic uses JSON• To make debugging protocol efficient:– Compress messages– Fetch object data on-demand

• Can use WER-style automated test scripts

Page 18: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Breakpoints

function f(x){ return x + 42;}

function f(x){ var dbgCmd,result; while(dbgCmd = Rivet.getDbgCmd(result)){ result = eval(dbgCmd); }

return x + 42;}

Put breakpoint here

Page 19: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Breakpoints

Create source code for f’()

eval() that source code to get a JavaScript function objectTraverse the heap, replace refs to f() with refs to f’()

Unpause the application

12

3

4

Page 20: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Live Patching

• Breakpoints are just an example!• Can use live patching to . . .– Dynamically install a bug fix– Create chat windows between user and developer– Implement stack traces

• See paper for details

Page 21: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

IT’S JUDGMENT DAY.

STATISTICAL SIGNIFICANCE EXPECTED.

Page 22: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Rivet Overheads: Normal Operation

Page 23: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Time to Pause an Application

Page 24: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Time to Pause an Application

Page 25: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Size of Interactive Debugging Messages

Page 26: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Serializing the DOM Tree

Page 27: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Related Work

Page 28: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Related Work: Built-in Debuggers

• The ones that do only support:– A single web engine that’s . . .– Configured by a guru and which . . .– Isn’t constrained by the same-origin

policy!

• Most don’t have native support for remote debugging– Could add support using a plugin . . .

BUT THAT IS GROSS

Page 29: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Related Work: Mugshot• A JavaScript logging+replay

framework• Rivet uses some Mugshot-style

trickeration . . .• . . . but has three advantages:– Rivet doesn’t need a proxy server– Rivet’s in situ exploration is less fragile– Rivet performs less runtime shimming

James mickens

Wrote the

mugshot paper

Page 30: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Conclusion

The way web pages used to be HOLLYWOOD HAS

RUINED EVERYTHING

Page 31: Rivet: Browser-agnostic Remote Debugging for Web Applications James Mickens.

Conclusion• Rivet: a browser-agnostic remote debugger– Runs on unmodified browsers (no plugins!)– Doesn’t require context proxy– Supports interactive debugging, automatic diagnostics

• Rivet had good performance!– Negligible slowdown during normal operation– Pausing applications is fast– Debugging messages are small

• Rivet can perform non-trivial diagnostics


Recommended