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 92943 - Deadlock when starting/stopping debugger
Summary: Deadlock when starting/stopping debugger
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P2 blocker (vote)
Assignee: Martin Entlicher
Depends on:
Blocks: 92999
  Show dependency tree
Reported: 2007-01-22 10:45 UTC by Jiri Skrivanek
Modified: 2007-03-20 11:26 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:

Thread dump. (29.90 KB, text/plain)
2007-01-22 10:47 UTC, Jiri Skrivanek
Thread dump in NB 5.5.1. (59.08 KB, text/plain)
2007-02-01 09:13 UTC, Jiri Skrivanek
The diff of the fix. (8.52 KB, patch)
2007-02-19 11:20 UTC, Martin Entlicher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Skrivanek 2007-01-22 10:45:37 UTC
I found a deadlock when I was verifying another one (issue 92771). It appeared
when I was starting and stopping debugger (web application). Maybe previous
debugger session was not finished yet but a new one wanted to start. Two threads
are waiting for <0x198d73e8> (a java.util.ArrayList) which is hold by other
thread. I am not sure whether it belong to web/jspdebug or jpdadebugger. To

- add Glassfish server to IDE
- set Swing HTML Browser as default web browser (Tools|Options)
- create a web application from template
- toggle breakpoint in index.jsp
- start debugger F5 and wait until it stops at breakpoint
- finish debugger
- go to Runtime view and expand nodes under server node to see deployed web
- start debugger again and wait for breakpoint
- finish debugger
- repeat start/stop debugger and sooner or later your IDE will freeze (see
attached thread dump).

Build 20070122-0455, JDK1.5.0_10, WindowsXP.
Comment 1 Jiri Skrivanek 2007-01-22 10:47:04 UTC
Created attachment 37562 [details]
Thread dump.
Comment 2 Libor Kotouc 2007-01-22 12:38:48 UTC
Debugger operator thread tries to set the stopped state while the current
session is being finished on another thread. Both threads use the same locks -
DebuggerManager.sessions and JPDADebuggerImpl.LOCK - in the opposite order which
results in deadlock.
Comment 3 Martin Entlicher 2007-01-22 17:10:32 UTC
O.K. we'll look at it.
Comment 4 Jiri Skrivanek 2007-02-01 09:11:36 UTC
We found the same deadlock in NB 5.5.1. I think it should be fixed in 5.5.1 as
well. I will attach thread dump generated during automated tests.
Comment 5 Jiri Skrivanek 2007-02-01 09:13:05 UTC
Created attachment 37908 [details]
Thread dump in NB 5.5.1.
Comment 6 Petr Blaha 2007-02-01 10:03:54 UTC
Marking as 5.5.1_candidate
Comment 7 Martin Entlicher 2007-02-01 11:30:53 UTC
We'll look at it during the M7 stabilization week. Scheduling for 6.0 for now.
Comment 8 Martin Entlicher 2007-02-14 17:27:57 UTC
Firing under the lock is bad.
Comment 9 Martin Entlicher 2007-02-16 15:05:54 UTC
It's fixed in trunk now:

new revision: 1.27; previous revision: 1.26

new revision: 1.113; previous revision: 1.112
Comment 10 Martin Entlicher 2007-02-16 15:06:50 UTC
Please verify the fix in trunk and I'll integrate it into 5.5.1 then. Thanks.
Comment 11 Jiri Skrivanek 2007-02-19 11:08:31 UTC
It seems to be fixed. I cannot reproduce it anymore.
Comment 12 Martin Entlicher 2007-02-19 11:20:33 UTC
Created attachment 38657 [details]
The diff of the fix.
Comment 13 Roman Ondruska 2007-02-19 12:49:14 UTC
Review: The fix is safe enough for integration into NB 5.5.1.
Comment 14 Martin Entlicher 2007-02-22 12:36:48 UTC
Thanks for the review and verification, the fix is merged into release551 branch:

new revision:; previous revision:

new revision:; previous revision:
Comment 15 Jiri Skrivanek 2007-03-20 11:26:35 UTC
Verified in NB5.5.1 20070314-1939.