Bug 75012 - Exception thrown when running WKBrowsingContextLoadDelegateTest.SimpleLoad test
Summary: Exception thrown when running WKBrowsingContextLoadDelegateTest.SimpleLoad test
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (Intel) OS X 10.7
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-21 09:58 PST by Adam Roben (:aroben)
Modified: 2011-12-21 11:08 PST (History)
2 users (show)

See Also:


Attachments
Patch (1.13 KB, patch)
2011-12-21 10:16 PST, Sam Weinig
aroben: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2011-12-21 09:58:24 PST
To reproduce:

1. build-api-tests --debug
2. run-test-webkit-api --debug

You'll see something like this:

[ RUN      ] WKBrowsingContextLoadDelegateTest.SimpleLoad
2011-12-21 12:56:16.300 TestWebKitAPI[15727:f07] -[WKBrowsingContextGroupData delegate]: unrecognized selector sent to instance 0x7fc25b916900
2011-12-21 12:56:16.301 TestWebKitAPI[15727:f07] An uncaught exception was raised
2011-12-21 12:56:16.301 TestWebKitAPI[15727:f07] -[WKBrowsingContextGroupData delegate]: unrecognized selector sent to instance 0x7fc25b916900
2011-12-21 12:56:16.308 TestWebKitAPI[15727:f07] (
	0   CoreFoundation                      0x00007fff8dc9f476 __exceptionPreprocess + 198
	1   libobjc.A.dylib                     0x00007fff86c515a6 objc_exception_throw + 43
	2   CoreFoundation                      0x00007fff8dd3254a -[NSObject(NSObject) doesNotRecognizeSelector:] + 186
	3   CoreFoundation                      0x00007fff8dc8d3e6 ___forwarding___ + 358
	4   CoreFoundation                      0x00007fff8dc8d208 _CF_forwarding_prep_0 + 232
	5   WebKit2                             0x000000010f5e568d _ZL19didCreateConnectionPK15OpaqueWKContextPK18OpaqueWKConnectionPKv + 61
	6   WebKit2                             0x000000010f5e9016 _ZN6WebKit26WebContextConnectionClient19didCreateConnectionEPNS_10WebContextEPNS_13WebConnectionE + 102
	7   WebKit2                             0x000000010f3659d6 _ZN6WebKit10WebContext25processDidFinishLaunchingEPNS_15WebProcessProxyE + 438
	8   WebKit2                             0x000000010f42e783 _ZN6WebKit15WebProcessProxy18didFinishLaunchingEj + 419
	9   WebKit2                             0x000000010f42e5cf _ZN6WebKit15WebProcessProxy18didFinishLaunchingEPNS_15ProcessLauncherEj + 31
	10  WebKit2                             0x000000010f42e7c5 _ZThn56_N6WebKit15WebProcessProxy18didFinishLaunchingEPNS_15ProcessLauncherEj + 53
	11  WebKit2                             0x000000010f34c8b3 _ZN6WebKit15ProcessLauncher25didFinishLaunchingProcessEij + 99
	12  WebKit2                             0x000000010f34e25c _ZN3WTF15FunctionWrapperIMN6WebKit15ProcessLauncherEFvijEEclEPS2_ij + 124
	13  WebKit2                             0x000000010f34e1cb _ZN3WTF17BoundFunctionImplINS_15FunctionWrapperIMN6WebKit15ProcessLauncherEFvijEEEFvPS3_ijEEclEv + 43
	14  WebKit2                             0x000000010f34f060 _ZN3WTF8FunctionIFvvEEclEv + 128
	15  WebKit2                             0x000000010f34ee47 _ZN7RunLoop11performWorkEv + 135
	16  WebKit2                             0x000000010f34ff80 _ZN7RunLoop11performWorkEPv + 96
	17  CoreFoundation                      0x00007fff8dc17531 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
	18  CoreFoundation                      0x00007fff8dc16df5 __CFRunLoopDoSources0 + 245
	19  CoreFoundation                      0x00007fff8dc3d0ff __CFRunLoopRun + 799
	20  CoreFoundation                      0x00007fff8dc3ca89 CFRunLoopRunSpecific + 233
	21  Foundation                          0x00007fff8703246e -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 268
	22  TestWebKitAPI                       0x000000010e9a549b _ZN13TestWebKitAPI4Util3runEPb + 139
	23  TestWebKitAPI                       0x000000010ea10ed4 _ZN49WKBrowsingContextLoadDelegateTest_SimpleLoad_Test8TestBodyEv + 276
	24  TestWebKitAPI                       0x000000010ea29fda _ZN7testing4Test3RunEv + 154
	25  TestWebKitAPI                       0x000000010ea2a91d _ZN7testing8internal12TestInfoImpl3RunEv + 189
	26  TestWebKitAPI                       0x000000010ea2b15d _ZN7testing8TestCase3RunEv + 205
	27  TestWebKitAPI                       0x000000010ea301b0 _ZN7testing8internal12UnitTestImpl11RunAllTestsEv + 736
	28  TestWebKitAPI                       0x000000010ea2fec9 _ZN7testing8UnitTest3RunEv + 25
	29  TestWebKitAPI                       0x000000010e9a5ff0 _ZN13TestWebKitAPI15TestsController3runEiPPc + 48
	30  TestWebKitAPI                       0x000000010e9a5e71 main + 113
	31  TestWebKitAPI                       0x000000010e9a5404 start + 52
	32  ???                                 0x0000000000000001 0x0 + 1
)
Comment 1 Adam Roben (:aroben) 2011-12-21 10:06:56 PST
The bug only occurs intermittently. Turning on zombies might make it easier to reproduce.

I suspect WKProcessGroup needs to clear the WKContextConnectionClient when it is destroyed.
Comment 2 Adam Roben (:aroben) 2011-12-21 10:07:12 PST
Sometimes I just see a crash instead of an exception.
Comment 3 Sam Weinig 2011-12-21 10:16:12 PST
Created attachment 120189 [details]
Patch
Comment 4 Adam Roben (:aroben) 2011-12-21 10:17:38 PST
Comment on attachment 120189 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=120189&action=review

> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:97
> +    WKContextSetConnectionClient(self._contextRef, 0);

The rest of this file uses _data->_contextRef.get(). Not sure which is better.
Comment 5 Sam Weinig 2011-12-21 10:19:13 PST
Committed r103412: <http://trac.webkit.org/changeset/103412>
Comment 6 Darin Adler 2011-12-21 11:08:12 PST
Comment on attachment 120189 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=120189&action=review

>> Source/WebKit2/UIProcess/API/mac/WKProcessGroup.mm:97
>> +    WKContextSetConnectionClient(self._contextRef, 0);
> 
> The rest of this file uses _data->_contextRef.get(). Not sure which is better.

self._contextRef does one additional Objective-C method dispatch, so it’s slower