Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2128314 | 5.0u6 | Mandy Chung | P3 | Resolved | Fixed | b01 |
/* This test is used to test jdb reporting wrong thread status information
Steps to reproduce the problem:
jdb FooTest
stop at FooTest:53 - the last line in changeVarOne()
run
cont - a few times
threads
All but one of Thread-0 through Thread-9 should be "waiting on a
monitor". But jdb reports more more than one threads "running". If you do a
where <thread id> on the running threads, you will see they are actually
waiting to enter the synchornized method. It seemed like once a thread has
been marked as running, jdb will always think it's a running thread even.
*/
public class FooTest
{
private static int _var;
public static void main(String[] args) throws Exception
{
for( int i = 0; i < 10; i++ )
{
final int j = i;
try
{
new Thread(
new Runnable()
{
public void run()
{
method( j );
method( j );
method( j );
}
public void method( int i )
{
changeVarOne(i);
}
}
).start();
}
catch( Exception e ) {}
}
}
public static int _varOne = -1;
synchronized static public void changeVarOne(int value)
{
boolean b = false;
_varOne = value;
}
}
Steps to reproduce the problem:
jdb FooTest
stop at FooTest:53 - the last line in changeVarOne()
run
cont - a few times
threads
All but one of Thread-0 through Thread-9 should be "waiting on a
monitor". But jdb reports more more than one threads "running". If you do a
where <thread id> on the running threads, you will see they are actually
waiting to enter the synchornized method. It seemed like once a thread has
been marked as running, jdb will always think it's a running thread even.
*/
public class FooTest
{
private static int _var;
public static void main(String[] args) throws Exception
{
for( int i = 0; i < 10; i++ )
{
final int j = i;
try
{
new Thread(
new Runnable()
{
public void run()
{
method( j );
method( j );
method( j );
}
public void method( int i )
{
changeVarOne(i);
}
}
).start();
}
catch( Exception e ) {}
}
}
public static int _varOne = -1;
synchronized static public void changeVarOne(int value)
{
boolean b = false;
_varOne = value;
}
}
- backported by
-
JDK-2128314 Blocked thread status is incorrectly reported as runnable
-
- Resolved
-