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.

Bug 49369 - Deadlock after restart of IDE
Summary: Deadlock after restart of IDE
Status: CLOSED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: issues@java
URL:
Keywords: THREAD
Depends on:
Blocks:
 
Reported: 2004-09-21 17:02 UTC by Lukas Hasik
Modified: 2007-09-26 09:14 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
last part of messages.log (29.68 KB, text/plain)
2004-09-21 17:03 UTC, Lukas Hasik
Details
thread dump (17.30 KB, text/plain)
2004-09-21 17:04 UTC, Lukas Hasik
Details
thread dump (25.41 KB, text/plain)
2004-09-22 16:20 UTC, Lukas Hasik
Details
thread dump (13.10 KB, text/plain)
2004-10-05 15:55 UTC, gc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lukas Hasik 2004-09-21 17:02:49 UTC
nb-build 200409200200 + me20040920

I worked with the ide. I had few projects opened.
After exit and restart the deadlock occured.

see attached messages.log there is IOException
see threaddump
Comment 1 Lukas Hasik 2004-09-21 17:03:43 UTC
Created attachment 17794 [details]
last part of messages.log
Comment 2 Lukas Hasik 2004-09-21 17:04:42 UTC
Created attachment 17795 [details]
thread dump
Comment 3 Lukas Hasik 2004-09-21 17:07:41 UTC
i was able to reproduce it two times with the userdir third time the
ide started normally
Comment 4 Petr Nejedly 2004-09-22 10:25:41 UTC
Problem in J2ME modules. They have no category in issuezilla =>
closing as INVALID.
Comment 5 Lukas Hasik 2004-09-22 12:49:14 UTC
wrong choice. We have category for j2me - reopening and reaasignig
Comment 6 Lukas Hasik 2004-09-22 12:50:16 UTC
reassigning to 3rd-party/j2me
Comment 7 Adam Sotona 2004-09-22 15:18:06 UTC
- this is probably called from Explorer when some node is drawn:
JavaDataObject.createCookie(JavaParser.class) calls
initializeParsingSupport() that requires
CloneableEditorSupport.getDocument()

- at the same time the same document is beeing opened in editor:
BaseDocument.runAtomicAsUser() calls
J2MEEditorSupport.loadFromStreamToKit() that requires
JavaDataObject.getCookie(EditorCookie.class) and this somehow calls
JavaDataObject.initializeParsingSupport()

So this is the deadlock and I don't know how to avoid it in J2ME stuff. 
I think that requesting EditorCookie during
J2MEEditorSupport.loadFromStreamToKit() is legitimate (please correct
me if I am wrong)
Comment 8 Lukas Hasik 2004-09-22 16:19:36 UTC
happend again with build 0922, attaching thread dump.
I just left open IDE for maybe hour when I was doing something else
and then I wanted to return.

Increasing priority 'cause it happens too often
Comment 9 Lukas Hasik 2004-09-22 16:20:16 UTC
Created attachment 17808 [details]
thread dump
Comment 10 Martin Matula 2004-09-23 10:19:51 UTC
The problem is that initializeParsingSupport cannot be called under
CookieSet.CookieEntry locked if the repository is not locked first.
We have solved this for JavaDataObject by overriding getCookie method
and starting MDR transaction if the createCookie is going to be called
for certain types of cookies. However in this stacktrace
FilterNode.getCookie seems to be involved. So I don't know how this
could be solved. CC'ing Yarda, maybe he can help.
Comment 11 Jaroslav Tulach 2004-09-23 13:53:03 UTC
JavaDataObject.getCookie override is wrong fix. As it can be bypassed
by NodeLookup (sorry, my improvent in 3.6). Btw. this can happen
without kjava as well. Just call item =
yourNode.getLookup().lookupItem(yourCookie.class) in another thread
lock mdr and then call item.getInstance(). that will deadlock. You may
want to write a test for that...

The only, but straight forward fix, I can imagine is to not do
anything in cookies' constructors. Let them be initialized later
lazily when their first method is called.
Comment 12 Martin Matula 2004-09-24 11:17:12 UTC
See also related issue 48820.
Comment 13 Martin Matula 2004-09-29 16:53:15 UTC
Fixed.

Checking in src/org/netbeans/modules/java/JavaDataObject.java;
/cvs/java/src/org/netbeans/modules/java/JavaDataObject.java,v  <-- 
JavaDataObject.java
new revision: 1.195; previous revision: 1.194
done
Checking in src/org/netbeans/modules/java/JavaNode.java;
/cvs/java/src/org/netbeans/modules/java/JavaNode.java,v  <-- 
JavaNode.java
new revision: 1.121; previous revision: 1.120
done
Checking in src/org/netbeans/modules/java/JavaParserGlue.java;
/cvs/java/src/org/netbeans/modules/java/JavaParserGlue.java,v  <-- 
JavaParserGlue.java
new revision: 1.52; previous revision: 1.51
done
Processing log script arguments...
More commits to come...
Checking in
src/org/netbeans/modules/java/codesync/SourceConnectionSupport.java;
/cvs/java/src/org/netbeans/modules/java/codesync/SourceConnectionSupport.java,v
 <--  SourceConnectionSupport.java
new revision: 1.25; previous revision: 1.24
done
Comment 14 Jaroslav Tulach 2004-09-30 07:51:34 UTC
What exactly is the fix? Not adding listener to SourceElement which
should be added, but as the feature does not work now, it is ok, if
not added? Unbelievable.
Comment 15 gc 2004-10-05 15:55:47 UTC
Created attachment 18050 [details]
thread dump
Comment 16 gc 2004-10-05 15:56:09 UTC
Not sure if this is the same issue, but i'm attaching a new
deadlock-dump that occurred using Beta2 install when opening a file
via 'alt+G' editor shortcut.  Treating as this issue because deadlock
is still being caused in part by conflict between mdr and
JavaDataObject.getCookie call described by Adam Sotona above.
Comment 17 Martin Matula 2004-10-05 16:59:05 UTC
This is fixed. It was fixed after Beta2 was released, so you will need
to get the newest dev build to get the fix.
Comment 18 Jiri Prox 2005-07-12 11:56:10 UTC
Lukasi, can you verify this issue, please? Thanks.
Comment 19 Lukas Hasik 2005-07-13 09:36:52 UTC
closing as verified - I don't know how to reproduce but it's out of my radar for
now. I do expect that it was fixed long time ago because I haven't seen it
nevermore...