Bug 142191 - Exception stack unwinding in JSC hangs while the Timeline Profiler is enabled
Summary: Exception stack unwinding in JSC hangs while the Timeline Profiler is enabled
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mark Lam
Keywords: InRadar
Depends on: 142189
  Show dependency treegraph
Reported: 2015-03-02 15:20 PST by Mark Lam
Modified: 2015-03-02 16:30 PST (History)
4 users (show)

See Also:

the patch. (7.99 KB, patch)
2015-03-02 15:54 PST, Mark Lam
ggaren: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Lam 2015-03-02 15:20:06 PST
Imagine a scenario where the Inspector is paused / suspended at a breakpoint or while the user is stepping through code.  The user then tries to evaluate an expression in the console, and that evaluation results in an exception being thrown.  Currently, if the Timeline Profiler is enabled while this exception is being thrown, the WebProcess will hang while trying to handle that exception.

The issue is that the Timeline Profiler's ProfileGenerator::didExecute() will return early and decline to process ProfileNodes if the Inspector is paused.  This is proper because it does not want to count work done for injected scripts (e.g. from the console) towards the timeline profile of the webpage being run.  However, this is in conflict with ProfileGenerator::exceptionUnwind()'s expectation that didExecute() will process ProfileNodes in order to do the stack unwinding for the exception handling.  As a result, ProfileGenerator::exceptionUnwind() hangs.

ProfileGenerator::exceptionUnwind() is in error.  While the Inspector is paused, there will not be any ProfileNodes that it needs to "unwind".  Hence, the fix is simply to return early also in ProfileGenerator::exceptionUnwind() if the Inspector is paused.
Comment 1 Mark Lam 2015-03-02 15:21:37 PST
Comment 2 Mark Lam 2015-03-02 15:54:44 PST
Created attachment 247709 [details]
the patch.
Comment 3 Geoffrey Garen 2015-03-02 16:14:26 PST
Comment on attachment 247709 [details]
the patch.

Comment 4 Mark Lam 2015-03-02 16:30:12 PST
Thanks for the review.  Landed in r180907: <http://trac.webkit.org/r180907>.

Sorry for the botched commit message.  Should have re-checked the diffs after I svn up'ed.