This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Build 200401111900 Deadlock occured after the opening of file.
Created attachment 12840 [details] Deadlock's threaddump.
Created attachment 12841 [details] An exception thrown before deadlock.
The exception is probably unrelated - it's deadlock related to the document loading in openide.text. I do not clearly understand why the document loading thread cannot proceed. Both threads - AWT and the first RP should not have access to the document prior to its complete loading. The only exception would be reloading of the file. Emane, it's likely hard to remember ;-) but was not there an external modification to the file done prior to opening of it?
Probably, it was.
I've eplored the stacktrace again and it appears that there is a document loading and the situation is like this: 1) JavaParser RP - holds read lock over the document - org.netbeans.editor.BaseDocument.render(BaseDocument.java:883) - waits for prepareDocument() task to finish 2) Document Loading RP - wants to acquire the write lock on the document in order to load the new document content 3) AWT - similar to 1) i.e. it has acquired the readLock() and waits for prepareDocument() task to finish As the 2) cannot proceed due to existing read locks from 1) and 3) the document loading will not finish but that blocks 1) and 3). Unfortunately I see no easy solution how to avoid this kind of deadlock. The document seems to already be known to the threads 1) and 3) and they acquire read lock on it prior to the loading RP acquires the write lock on it and starts actual loading. Reassigning to openide/editor to Petr N. for further evaluation. I hope that I have overlooked something that could help to fix this problem.
I've evaluated the problem, and the only solution I've found is to perform the whole reload operation under a write lock - that is, not only the load but also all the work with state machines and so on. I'll try to verify this desigh.
Should fix this for 3.6
Seems like doing the reload synchronously and in writelock is the best way to solve this. I have a working patch now, I'll try to also clean up the code a bit.
Fixed as outlined above. openide/src/org/openide/text/CloneableEditorSupport.java,v1.116
Eman, could you verify ? Thanks.
I haven't seen the deadlock for a long time. I belive the fix will help.