|
Quick Lists
|
|
Bug ID:
|
4776385
|
|
Votes
|
2
|
|
Synopsis
|
REGRESSION: Use of synchronized code blocks incompatible with 1.4.x & 1.2.x
|
|
Category
|
java:runtime
|
|
Reported Against
|
1.4.1
|
|
Release Fixed
|
|
|
State
|
11-Closed,
Will Not Fix,
bug
|
|
Priority:
|
3-Medium
|
|
Related Bugs
|
|
|
Submit Date
|
08-NOV-2002
|
|
Description
|
FULL PRODUCT VERSION :
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
FULL OPERATING SYSTEM VERSION : Microsoft Windows 2000
[Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
Given a synchronized code block within a method that is
compiled using JDK 1.4.x an attempt to execute the code
using JDK 1.2.x results in the following run-time error
message "Exception in thread "main"
java.lang.IllegalMonitorStateException: current thre
d not owner"
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Compile java source code with synchronized code block in
a method using JDK 1.4.x
2. Run code using JDK 1.4.x Code runs fine.
3. Run code using JDK 1.2.x Run-time error is generated
EXPECTED VERSUS ACTUAL BEHAVIOR :
---BEGIN JDK 1.4.1 ----
As compiled and run with JDK 1.4.1
C:\testsynch>java -version
java version "1.4.1_01"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.1_01-b01)
Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode)
C:\testsynch>javac -classpath .; Test.java
C:\testsynch>java -cp .; Test
This is a test
C:\testsynch>
--- END JDK 1.4.1 ---
--- BEGIN JDK 1.2.2 ----
Class compiled using JDK 1.4.1 and run with JDK 1.2.2
C:\testsynch>java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2_007, native threads, symcjit)
C:\testsynch>java -cp .; Test
This is a test
Exception in thread "main"
java.lang.IllegalMonitorStateException: current thre
d not owner
at Test.main(Test.java:5)
C:\testsynch>
--- END JDK 1.2.2 ---
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.IllegalMonitorStateException: current thre
d not owner
at Test.main(Test.java:5)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
public static void main(String[] args) {
Test t = new Test();
t.execute();
}
public void execute() {
synchronized(this) {
System.out.println("This is a test");
}
}
}
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
No known workaround. As a developer of thread-safe
components I use synchronized code blocks frequently.
Unfortunately this prevents me from supporting JDK 1.2.x
end users when compiling with JDK 1.4.x
Release Regression From : 1.4.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 166702)
======================================================================
|
|
Work Around
|
Compile in JDK 1.2.2 and run on all JDK's from 1.2.2 and up.
xxxxx@xxxxx 2002-11-11
Alternative, install hotspot 2.0 vm in jdk 1.2.2_014 and all should be fine.
xxxxx@xxxxx 2002-11-11
Note: any fix would have to be in the JDK 1.2.2 vm which would require a
VM download for your customers - so you can choose to either require
your customers to download the hotspot 2.0 vm or build on the
earliest release you want to support.
|
|
Evaluation
|
This appears to be a bug in the 1.2.2 windows runtime. The compiler-generated
code appears to be correct.
xxxxx@xxxxx 2002-11-08
Running with -classic VM is the issue here. After installing hotspot 2.0 into
JDK 1.2.2_14 the program ran fine when compiled with JDK 1.4.2 and run on
JDK 1.2.2_14
xxxxx@xxxxx 2002-11-11
xxxxx@xxxxx 2002-11-26
Appears to be a bug with the 1.2.2 symcjit. If I run javac on 1.4.2,
and then run java_g on 1.2.2_014 I get the following message:
" Warning: JIT compiler "symcjit" not found. Will use interpreter
And the test passes.
Running with 1.2.2_014 java gets the exception. This appears to
be a bug in the JIT compiler "symcjit" on 1.2.2.
Alternatively it could be a difference between the synchronization
path between debug and product.
|
|
Comments
|
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |