Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354700 - ModalContextThread leaking
Summary: ModalContextThread leaking
Status: RESOLVED DUPLICATE of bug 352437
Alias: None
Product: RAP
Classification: RT
Component: JFace (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-14 00:07 EDT by Chris Fairhall CLA
Modified: 2011-08-22 02:40 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Fairhall CLA 2011-08-14 00:07:42 EDT
Build Identifier: 1.5.0.20110720-0846

I've started using ProgressMonitorDialogs to give user feedback to long running operations.
This was going great until we started running out of memory.

I've found that if a user closes their browser while a progress dialog is open its ModalContextThread will never terminate. It is stuck in a display.syncExec.


It looks like a syncExec call will never return after the display is disposed of. The caller sits in a while(!lock.done()) lock.wait()
Interrupting the thread won't even break it out as the exception is caught and not dealt with until after lock.done() == true

The ModalContextThread holds references to the Display (and from there, all widgets, etc...) and UIThread, stopping them from being garbage collected as being a Thread it is a GC root.

It is also impossible to hack around this as the only reference left to the RunnableLock after the Display is disposed is on a stack frame inside a method.


Currently the only fix I can think of is setting a Throwable to all the current runnable locks and notifying them when a display is disposed. That would propagate the throwable to the caller of syncExec (wrapped in an SWTException)


Reproducible: Always

Steps to Reproduce:
1. Create a ModalContext via new ProgressMonitorDialog(...)
2. Dispose of Display before the ModalContextThread finishes
3. ModalContextThread will never terminate
Comment 1 Ivan Furnadjiev CLA 2011-08-14 02:41:28 EDT
For me this bug sounds like a duplicate of Bug 352437, which has been fixed in CVS HEAD and v14_Maintenance branch. Please give the latest nightly build a try and report it back. The patch applied is attached to the bug as well.
Comment 2 Chris Fairhall CLA 2011-08-14 05:46:38 EDT
(In reply to comment #1)
> For me this bug sounds like a duplicate of Bug 352437
Sorry, should have looked harder in the existing bugs
Comment 3 Ivan Furnadjiev CLA 2011-08-22 02:40:18 EDT
(In reply to comment #2)
Closed as duplicate.

*** This bug has been marked as a duplicate of bug 352437 ***