Bug 10200 - [Drosera] Deadlock between Drosera and Safari while loading page
Summary: [Drosera] Deadlock between Drosera and Safari while loading page
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Timothy Hatcher
URL:
Keywords: HasReduction
Depends on:
Blocks:
 
Reported: 2006-08-02 00:15 PDT by Mark Rowe (bdash)
Modified: 2008-05-17 09:55 PDT (History)
0 users

See Also:


Attachments
Backtrace from Drosera while deadlocked (3.64 KB, text/plain)
2006-08-02 00:18 PDT, Mark Rowe (bdash)
no flags Details
Backtrace from Safari while deadlocked (7.50 KB, text/plain)
2006-08-02 00:18 PDT, Mark Rowe (bdash)
no flags Details
Reduced test case (100 bytes, text/html)
2006-08-02 00:20 PDT, Mark Rowe (bdash)
no flags Details
Proposed fix (8.73 KB, patch)
2006-08-02 10:01 PDT, Timothy Hatcher
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Rowe (bdash) 2006-08-02 00:15:39 PDT
When loading the web archive (attachment 9807 [details]) attached to bug 10057 while Drosera is attached to Safari, Drosera and Safari will reproducibly get into a deadlock situation after continuing the first few JS exceptions that are raised.
Comment 1 Mark Rowe (bdash) 2006-08-02 00:18:21 PDT
Created attachment 9808 [details]
Backtrace from Drosera while deadlocked
Comment 2 Mark Rowe (bdash) 2006-08-02 00:18:51 PDT
Created attachment 9809 [details]
Backtrace from Safari while deadlocked
Comment 3 Mark Rowe (bdash) 2006-08-02 00:20:34 PDT
Created attachment 9810 [details]
Reduced test case

Reduction of the page within the web archive that produces the deadlock.  No plugins required.
Comment 4 Timothy Hatcher 2006-08-02 09:03:47 PDT
I have an idea how to fix this.
Comment 5 Timothy Hatcher 2006-08-02 09:28:17 PDT
I am testing a fix now. This testcase now works with no deadlock. The weird thing is our introspection script is showing up as a script from "about:blank".

(function () { var result = new Array(); for (var x in this) { result.push(x); } return result; })

One interesting note:

Unsafe JavaScript attempt to access frame with URL http://bugzilla.opendarwin.org/attachment.cgi?id=9810&action=view from frame with URL about:blank. Domains must match.
Unsafe JavaScript attempt to access frame with URL http://bugzilla.opendarwin.org/attachment.cgi?id=9810&action=view from frame with URL about:blank. Domains must match.
[3976] http://bugzilla.opendarwin.org/attachment.cgi?id=9810&action=view line 4: ReferenceError: Can't find variable: foo
Comment 6 Timothy Hatcher 2006-08-02 10:01:40 PDT
Created attachment 9824 [details]
Proposed fix

Prevent reentrancy in our debugger callbacks. This was causing a deadlock in Drosera because suspendProcessIfPaused was being called during a DO call into Safari.

Preventing reentrancy also prevents scripts that Drosera injects and evaluates from showing up in rare cases (such as a iframe loading about:blank). I thought this would prevent cases where you call a function from the console and expect it to break on a breakpoint in them, but this appears to never have worked even without this change. When that is figured out we can reconsider a better solution to reentrancy. I have filed that as bug 10214.

I also removed the NSRunLoop runMode:beforeDate: calls since DO handles this for us since we don't use "onway void" as the return type for the callbacks. Note: using onway void for the listener callbacks causes bad synchronization issues and obscure crashes.

* DefaultDelegates/WebScriptDebugServer.m:
(-[WebScriptDebugServer webView:didLoadMainResourceForDataSource:]):
(-[WebScriptDebugServer webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:]):
(-[WebScriptDebugServer webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:]):
(-[WebScriptDebugServer webView:didEnterCallFrame:sourceId:line:forWebFrame:]):
(-[WebScriptDebugServer webView:willExecuteStatement:sourceId:line:forWebFrame:]):
(-[WebScriptDebugServer webView:willLeaveCallFrame:sourceId:line:forWebFrame:]):
(-[WebScriptDebugServer webView:exceptionWasRaised:sourceId:line:forWebFrame:]):
* DefaultDelegates/WebScriptDebugServerPrivate.h:
Comment 7 Darin Adler 2006-08-02 16:03:51 PDT
Comment on attachment 9824 [details]
Proposed fix

r=me
Comment 8 Timothy Hatcher 2006-08-02 16:09:16 PDT
Landed in r15761.
Comment 9 Timothy Hatcher 2008-05-17 09:55:56 PDT
Closing since Drosera has been replaced by the new Web Inspector debugger. Moving to the New Bugs component so the Drosera component can be closed and removed.