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

Bug 361541

Summary: Critical code in Graph.dispose() may lead to deadlock and frozen eclipse
Product: [Tools] GEF Reporter: Jan Mauersberger <mauersberger>
Component: GEF-Legacy ZestAssignee: gef-inbox <gef-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: nyssen, steeg
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Jan Mauersberger CLA 2011-10-20 09:30:25 EDT
Build Identifier: 

The code in Graph.dispose() starts with:

while (nodes.size() > 0) {
  GraphNode node = (GraphNode) nodes.get(0);
  if (node != null && !node.isDisposed()) {
    node.dispose();
  }
}

Disposed nodes are not removed in the code but only implicitly by a call to node.dispose(). Hence in case a node is in the graph that is already disposed for some reason an infinite loop is entered.

Don't ask me how I managed to get a disposed node in there but I did and the whole eclipse did freeze. It might be that the disposed node crept in due to another bug (with exception) and essential code did not get executed. Anyway, I think we could make this code more robust since there is no reason why we should check for disposed nodes because any disposed one causes an inifite loop

Reproducible: Always
Comment 1 Fabian Steeg CLA 2011-10-21 17:16:35 EDT
Thanks, that's a nasty freeze indeed - fixed in 1.x head and 2.x master, see GraphTests#testDisposeGraphWithDisposedNode and ...WithDisposedConnection.

http://git.eclipse.org/c/gef/org.eclipse.zest.git/commit/?id=e071b4d85594311