Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 144990 Details for
Bug 287096
[hotbug] ModelManagerImpl is highly susceptible to deadlock
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
A first step toward avoiding the deadlock (does not fix the root issue)
deadlock_avoidance.txt (text/plain), 3.26 KB, created by
Cameron Bateman
on 2009-08-19 12:11:17 EDT
(
hide
)
Description:
A first step toward avoiding the deadlock (does not fix the root issue)
Filename:
MIME Type:
Creator:
Cameron Bateman
Created:
2009-08-19 12:11:17 EDT
Size:
3.26 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.wst.sse.core >Index: src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.wst.sse.core/src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java,v >retrieving revision 1.36 >diff -u -r1.36 ModelManagerImpl.java >--- src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java 22 Apr 2009 03:58:35 -0000 1.36 >+++ src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java 19 Aug 2009 15:44:54 -0000 >@@ -108,9 +108,10 @@ > int referenceCountForEdit; > int referenceCountForRead; > IStructuredModel theSharedModel; >- boolean initializing = true; >- boolean doWait = true; >- >+ volatile boolean initializing = true; >+ volatile boolean doWait = true; >+ final Object loadLock = new Object(); >+ > SharedObject(IStructuredModel sharedModel) { > theSharedModel = sharedModel; > referenceCountForRead = 0; >@@ -123,15 +124,30 @@ > * However, upon leaving this method, theShareModel variable > * is up-to-date. > */ >- public synchronized void waitForLoadAttempt() { >- while(initializing) { >- try { >- wait(); >- } >- catch (InterruptedException e) { >- // ignore interruption! >- } >- } >+ public void waitForLoadAttempt() { >+ int maxTimeMs = 3000; >+ final int waitInterval = 1000; >+ WAIT_LOOP: while (initializing && maxTimeMs >= 0) >+ { >+ try >+ { >+ synchronized(loadLock) >+ { >+ loadLock.wait(waitInterval); >+ } >+ maxTimeMs -= waitInterval; >+ } >+ catch (InterruptedException e) >+ { >+ break WAIT_LOOP; >+ } >+ } >+ >+ if (initializing) >+ { >+ throw new RuntimeException( >+ "Timed out waiting for model to load"); >+ } > } > > /** >@@ -139,9 +155,12 @@ > * {@link #waitForLoadAttempt()} will proceed after this > * method returns. > */ >- public synchronized void setLoaded() { >+ public void setLoaded() { > initializing = false; >- notifyAll(); >+ synchronized(loadLock) >+ { >+ loadLock.notifyAll(); >+ } > } > } > >@@ -1159,10 +1178,12 @@ > // and return the object. > SYNC.release(); > doRelease=false; >+ >+ if (sharedObject.doWait) { >+ sharedObject.waitForLoadAttempt(); >+ } >+ > synchronized(sharedObject) { >- if (sharedObject.doWait) { >- sharedObject.waitForLoadAttempt(); >- } > if (sharedObject.theSharedModel!=null) { > _incrCount(sharedObject, EDIT); > } >@@ -1242,10 +1263,10 @@ > SYNC.release(); > doRelease=false; > >+ if (sharedObject.doWait) { >+ sharedObject.waitForLoadAttempt(); >+ } > synchronized(sharedObject) { >- if (sharedObject.doWait) { >- sharedObject.waitForLoadAttempt(); >- } > if (sharedObject.theSharedModel!=null) { > _incrCount(sharedObject, READ); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 287096
: 144990 |
145676
|
145681
|
145821
|
145825
|
145829
|
146449
|
147495
|
147502
|
166062
|
166063