Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 513837

Summary: [Webkit2] Occasional crash on libjavascriptcoregtk-4.0.so during gtk_widget_destroy
Product: [Eclipse Project] Platform Reporter: Leo Ufimtsev <lufimtse>
Component: SWTAssignee: Leo Ufimtsev <lufimtse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: benken, mike
Version: 4.7   
Target Milestone: 4.7 M7   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/93420
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=95aee4d875873e0a962f582c45b052bd8ef741c5
https://bugs.eclipse.org/bugs/show_bug.cgi?id=522733
Whiteboard:
Bug Depends on:    
Bug Blocks: 441568    
Attachments:
Description Flags
Webkit2_BrowserTest5_crash.log
none
Webkit2_Btest_BrowserFunction_callback_with_integer_crash.log
none
Webkit2_test_BrowserFunction_callback_with_multipleValues.log none

Description Leo Ufimtsev CLA 2017-03-17 16:50:40 EDT
*Very rarely*, but sometimes I catch Webkit2 crashing during jUnit test runs.

It seems to happen once or twice a week. I don't have a way to reproduce it in a repeatable manner.

Sometimes if I run AllBrowserTests in a loop for many hours, *sometimes* it also occurs.

The pattern seems that the parent shell is 'closed', which eventually triggers OS.gtk_widget_destroy() on the parent. During this time it seems a javascript call is made and there is a crash deep down in libjavascriptcoregtk.

My educated guess is that running 'evaluate()' or a callback from BrowserFunction while Browser is being disposed could be related as they would invoke libjavascriptcoregtk library at some point, which might run into some nullpointer.

Attached are two crash dumps. One that occurred during BrowserTest5, the other in test_BrowserFunction_callback_with_integer. Both have a simmilar stack trace:
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
> C  [libjavascriptcoregtk-4.0.so.18+0xcbae5c]  WTFCrash+0x1c
> 
> Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
> J 1621  org.eclipse.swt.internal.gtk.OS._gtk_widget_destroy(J)V (0 bytes) @ 0x00007f037921c481 [0x00007f037921c440+0x41]
> J 1393 C1 org.eclipse.swt.widgets.Widget.release(Z)V (90 bytes) @ 0x00007f0379485824 [0x00007f0379484fe0+0x844]

I will submit some patches aimed at trying to fix this. This would entail doing less evaluation()/execute() in the browser dispose mechanism.

If someone catches more of these crashes, please attach crash dumps and let me know what was going on during this crash.
Comment 1 Leo Ufimtsev CLA 2017-03-17 16:51:29 EDT
Created attachment 267326 [details]
Webkit2_BrowserTest5_crash.log
Comment 2 Leo Ufimtsev CLA 2017-03-17 16:51:54 EDT
Created attachment 267327 [details]
Webkit2_Btest_BrowserFunction_callback_with_integer_crash.log
Comment 3 Leo Ufimtsev CLA 2017-03-17 17:00:40 EDT
Created attachment 267328 [details]
Webkit2_test_BrowserFunction_callback_with_multipleValues.log
Comment 4 Eclipse Genie CLA 2017-03-20 10:10:52 EDT
New Gerrit change created: https://git.eclipse.org/r/93420
Comment 6 Leo Ufimtsev CLA 2017-03-20 11:11:13 EDT
(In reply to Eclipse Genie from comment #5)
> Gerrit change https://git.eclipse.org/r/93420 was merged to [master].
> Commit:
> http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/
> ?id=95aee4d875873e0a962f582c45b052bd8ef741c5

Pending to see if crash is fixed by this. Will review in a week or so.
Comment 7 Leo Ufimtsev CLA 2017-03-27 10:37:59 EDT
Haven't observed crash since patch. Closing for now. Please re-open if you do find similar stack trace.
Comment 8 Michael Vorburger CLA 2017-10-14 06:38:52 EDT
If you hit this one from a Web Search, then see more recent Bug 522733 instead.
Comment 9 Leo Ufimtsev CLA 2017-10-16 12:20:07 EDT
(In reply to Michael Vorburger from comment #8)
> If you hit this one from a Web Search, then see more recent Bug 522733
> instead.

Thanks for linking these.