Bug 568889 - syncExec in MenuManagerRenderer causes deadlock on shutdown
Summary: syncExec in MenuManagerRenderer causes deadlock on shutdown
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.17   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 4.18 RC1   Edit
Assignee: Andrey Loskutov CLA
QA Contact:
URL:
Whiteboard:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2020-11-17 08:01 EST by Hans Schoen CLA
Modified: 2021-03-28 13:48 EDT (History)
3 users (show)

See Also:
akurtakov: pmc_approved+


Attachments
Stacktraces of blocking threads (3.69 KB, text/plain)
2020-11-17 08:01 EST, Hans Schoen CLA
no flags Details
Very small sample to reproduce the bug (3.81 KB, application/x-zip-compressed)
2020-11-23 10:13 EST, Hans Schoen CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hans Schoen CLA 2020-11-17 08:01:28 EST
Created attachment 284786 [details]
Stacktraces of blocking threads

We are developing a product based on Eclipse RCP. With Eclipse platform 4.17 our application does not shutdown anymore. With Eclipse platform 4.16 the shutdown still works.
We noticed that in Eclipse 4.17 a Display.syncExec() was add to method MenuManagerRenderer.contextDisposed(). It looks like that syncExec() call prevents our application to terminate. 

We added the stacktraces in the attachments.
Comment 1 Andrey Loskutov CLA 2020-11-17 08:27:28 EST
Regression from bug 563386.

@Hans: could you please provide a simple standalone example demonstrating the problem?
Comment 2 Hans Schoen CLA 2020-11-23 10:13:27 EST
Created attachment 284857 [details]
Very small sample to reproduce the bug

Here comes a very small bug sample that I stripped down from our code.

I also checked the sample code against v4.16 and with v4.16 I see the 'org.eclipse.swt.SWTException: Invalid thread access' issue.
Comment 3 Andrey Loskutov CLA 2020-11-24 06:10:52 EST
(In reply to Hans Schoen from comment #2)
> Created attachment 284857 [details]
> Very small sample to reproduce the bug
> 
> Here comes a very small bug sample that I stripped down from our code.
> 
> I also checked the sample code against v4.16 and with v4.16 I see the
> 'org.eclipse.swt.SWTException: Invalid thread access' issue.

That was the point of the fix for bug 563386, but now we have a deadlock instead :-(. I can reproduce. Amazingly how less code is needed to create a deadlock :-)

@Karsten: any objections if we simply replace syncExec() with asyncExec()?
Comment 4 Eclipse Genie CLA 2020-11-24 06:10:57 EST
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/172734
Comment 5 Andrey Loskutov CLA 2020-11-24 06:14:01 EST
(In reply to Eclipse Genie from comment #4)
> New Gerrit change created:
> https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/172734

@Alex: that fixes the deadlock, wondering if we should take it into 4.18 RC1?
Comment 7 Andrey Loskutov CLA 2020-11-25 04:19:37 EST
Thanks Alex.