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 17855 - Enhance debugging of multithreaded applications
Summary: Enhance debugging of multithreaded applications
Status: CLOSED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 3.x
Hardware: PC Linux
: P3 blocker with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-20 08:52 UTC by Jaroslav Tulach
Modified: 2010-04-29 09:09 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jaroslav Tulach 2001-11-20 08:52:49 UTC
While searching for race condition bug in FolderInstanceTest (which includes
three threads running and communicating) I've got to a situation when I needed
to stop one thread, but let other two continue step by step to simulate the
worsest thread switching I could imagine.

The problem is right now there is no way to say, go on, but let one thread stay.
I have figured out a workaround:

boolean stop = false;
do {
	// nothing
} while (stop);

place a breakpoint to the //nothing line and when hit change the value of stop
to true via debugger properties. Works, but requires modification of source, and
is pretty ugly anyway.

Instead of this I ask for special status of a thread: Suspended by user forever.
Which would mean that the debugger will never resume the thread on F8, F7, Go
on, etc...

I imagine a small change in Thread properties: Instead of Suspended=True/False
put there Status=Suspended/Running/Stopped where "Stopped" could be choosen just
by user to indicate that this thread should never be resumed...

I might try to create a patch if you give me some hints...
Comment 1 Jan Chalupa 2001-11-27 12:18:43 UTC
Target milestone -> 3.3.1.
Comment 2 Jaroslav Tulach 2002-01-10 16:36:00 UTC
I really need it. At least tell me where to implement the enhancement.
Comment 3 Jaroslav Tulach 2002-01-28 01:07:12 UTC
As a result of discussion on nbui we have find out that there is an
inconsistence bug in the debugger. See

http://www.netbeans.org/servlets/ReadMsg?msgId=243417&listName=nbui

It is possible to suspend thread for ever when it is running, but it
is not possible to do it when it has stopped at breakpoint. 

That is why I have changed this issue to be a defect, but changed the
reported version to be 3.4dev, because I do not expect this  to be
fixed in 3.3 version.

Comment 4 Jan Stola 2002-01-28 10:42:43 UTC
Changed back to ENHANCEMENT.
The bug described is filled as a separate issue 19820.
Comment 5 Jaroslav Tulach 2002-02-20 12:46:26 UTC
Changes should be done in

org.netbeans.debugger.core.support.java.JavaThread
org.netbeans.debugger.core.support.java.nodes.ThreadNode
org.netbeans.debuggerjpda.core.*.JpdaThread

Comment 6 Marek Grummich 2002-07-22 09:41:31 UTC
Set target milestone to TBD
Comment 7 lkishalmi 2004-01-16 14:10:32 UTC
Implementing the usage of BreakPointRequest.SUSPEND_EVENT_THREAD would
help the problem. Breakpoints have a suspend  boolean property which
is quite useless, because if it set false the breakpoint does nothing
but, prints a line in the debugger console.  
Comment 8 Roman Ondruska 2005-05-10 14:07:58 UTC
Seems to be hot topic again ;-)
We are discussing this.
Comment 9 Milan Kubec 2005-05-10 16:22:54 UTC
TM should not be 'future' but 'asap' :-)
Comment 10 Jan Jancura 2005-05-11 08:05:17 UTC
I think that this issue is already implemented.
You should just go to Sessions View - pop-up menu and switch Scope to Debug
Current Thread.
That should cover your usecase.
But the problem is that this feature currently does not work -> P3 bug.
Comment 11 Jaroslav Tulach 2005-05-11 09:12:16 UTC
The feature is not implemented. I do not need to run current thread, I need to 
run all others. 
Comment 12 Martin Entlicher 2007-03-02 16:44:36 UTC
We plan to make the "Debug Current Thread" work into M8. In cooperation with
Threads View you can have running/suspended any threads you need during stepping.

Since you may encounter "deadlocks" when stepping in a single thread only caused
by waiting for other (suspended) threads, we will add some time-based check.
Comment 13 Martin Entlicher 2007-03-11 19:33:17 UTC
Fixed in trunk.
The "Debug Current Thread" option on Session does not resume all threads during
stepping. When the step on current thread takes long time, an informational
dialog is displayed asking the user whether all other threads should be resumed
(because of possible wait for monitors held by other threads).
Also thread state is better tracked now, we also prevent from having suspend
count of threads greater then 1 (suspend count greater then one is causing
strange exceptions and continue is not working as expected).

When system option "netbeans.debugger.singleThreadStepping" is set to true,
"Debug Current Thread" option is true by default. Otherwise it's false and need
to be set for every new session.


/cvs/ide/golden/deps.txt,v  <--  deps.txt
new revision: 1.468; previous revision: 1.467

/shared/data/ccvs/repository/debuggerjpda/nbproject/project.xml,v  <--  project.xml
new revision: 1.20; previous revision: 1.19

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/Bundle.properties,v
 <--  Bundle.properties
new revision: 1.73; previous revision: 1.72

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/JPDADebuggerImpl.java,v
 <--  JPDADebuggerImpl.java
new revision: 1.115; previous revision: 1.114

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/JPDAStepImpl.java,v
 <--  JPDAStepImpl.java
new revision: 1.7; previous revision: 1.6

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/actions/JPDADebuggerActionProvider.java,v
 <--  JPDADebuggerActionProvider.java
new revision: 1.13; previous revision: 1.12

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/actions/StepActionProvider.java,v
 <--  StepActionProvider.java
new revision: 1.36; previous revision: 1.35

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/actions/StepIntoActionProvider.java,v
 <--  StepIntoActionProvider.java
new revision: 1.33; previous revision: 1.32

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/actions/StepOperationActionProvider.java,v
 <--  StepOperationActionProvider.java
new revision: 1.3; previous revision: 1.2

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/models/JPDAThreadGroupImpl.java,v
 <--  JPDAThreadGroupImpl.java
new revision: 1.7; previous revision: 1.6

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/models/JPDAThreadImpl.java,v
 <--  JPDAThreadImpl.java
new revision: 1.26; previous revision: 1.25

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/models/ThreadsTreeModel.java,v
 <--  ThreadsTreeModel.java
new revision: 1.9; previous revision: 1.8

/shared/data/ccvs/repository/debuggerjpda/src/org/netbeans/modules/debugger/jpda/util/Operator.java,v
 <--  Operator.java
new revision: 1.46; previous revision: 1.45

/shared/data/ccvs/repository/debuggerjpda/ui/src/org/netbeans/modules/debugger/jpda/ui/actions/RunIntoMethodActionProvider.java,v
 <--  RunIntoMethodActionProvider.java
new revision: 1.13; previous revision: 1.12
Comment 14 Quality Engineering 2010-04-29 09:09:04 UTC
Verified ... and Closing all issues resolved into NetBeans 6.7 and earlier.