Name: gm110360 Date: 06/18/2003
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 XP [Version 5.1.2600]
EXTRA RELEVANT SYSTEM CONFIGURATION :
Dual processor Machine
A DESCRIPTION OF THE PROBLEM :
When execution XMLEncoder.writeObject(Object .. )
with multiple threads on a dual processor box a lock
occures.
Diffrent version of the object is also written.
(Warning NullPointerException written randomly)even single
processor machine with multiple threads
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.Compile example files(2)
2.Execute example
3.Run few times till lock occurs.
4.Do thread dump
5.Lock occurs in class java.beans.Statement when calling
static variable methodCache (HashMap) that is not
synchronized.
EXPECTED VERSUS ACTUAL BEHAVIOR :
Application should exit normally but 1 or more threads lock.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Example thread dump:
Full thread dump Java HotSpot(TM) Client VM (1.4.0_03-b04 mixed mode):
"Thread-3" prio=5 tid=0x000344D8 nid=0xc44 waiting on monitor [0..7fb14]
"Bug Thread1" prio=5 tid=0x00A423B0 nid=0x7f4 runnable [ae9f000..ae9fdb4]
at java.util.HashMap.get(HashMap.java:316)
at java.beans.Statement.getMethod(Statement.java:360)
at java.beans.Statement.invoke(Statement.java:464)
at java.beans.Statement.execute(Statement.java:119)
at java.beans.Encoder.execute(Encoder.java:94)
at java.beans.Encoder.writeStatement(Encoder.java:238)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
at java.beans.DefaultPersistenceDelegate.invokeStatement
(DefaultPersistenceDelegate.java:242)
at java.beans.DefaultPersistenceDelegate.doProperty
(DefaultPersistenceDelegate.java:236)
at java.beans.DefaultPersistenceDelegate.initBean
(DefaultPersistenceDelegate.java:254)
at java.beans.DefaultPersistenceDelegate.initialize
(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject
(PersistenceDelegate.java:103)
at java.beans.Encoder.writeObject(Encoder.java:55)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
at java.beans.Encoder.writeExpression(Encoder.java:260)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
at java.beans.PersistenceDelegate.writeObject
(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:55)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
at java.beans.Encoder.writeObject1(Encoder.java:192)
at java.beans.Encoder.cloneStatement(Encoder.java:205)
at java.beans.Encoder.writeStatement(Encoder.java:236)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:253)
at XMLEncoderBug$OwnEncoder.run(XMLEncoderBug.java:180)
"Bug Thread0" prio=5 tid=0x00A42E98 nid=0xda8 runnable [ae5f000..ae5fdb4]
at java.util.HashMap.get(HashMap.java:316)
at java.beans.Statement.getMethod(Statement.java:360)
at java.beans.Statement.invoke(Statement.java:464)
at java.beans.Statement.execute(Statement.java:119)
at java.beans.Encoder.execute(Encoder.java:94)
at java.beans.Encoder.writeStatement(Encoder.java:238)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
at java.beans.DefaultPersistenceDelegate.invokeStatement
(DefaultPersistenceDelegate.java:242)
at java.beans.DefaultPersistenceDelegate.doProperty
(DefaultPersistenceDelegate.java:236)
at java.beans.DefaultPersistenceDelegate.initBean
(DefaultPersistenceDelegate.java:254)
at java.beans.DefaultPersistenceDelegate.initialize
(DefaultPersistenceDelegate.java:395)
at java.beans.PersistenceDelegate.writeObject
(PersistenceDelegate.java:103)
at java.beans.Encoder.writeObject(Encoder.java:55)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
at java.beans.Encoder.writeExpression(Encoder.java:260)
at java.beans.XMLEncoder.writeExpression(XMLEncoder.java:351)
at java.beans.PersistenceDelegate.writeObject
(PersistenceDelegate.java:100)
at java.beans.Encoder.writeObject(Encoder.java:55)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:250)
at java.beans.Encoder.writeObject1(Encoder.java:192)
at java.beans.Encoder.cloneStatement(Encoder.java:205)
at java.beans.Encoder.writeStatement(Encoder.java:236)
at java.beans.XMLEncoder.writeStatement(XMLEncoder.java:320)
at java.beans.XMLEncoder.writeObject(XMLEncoder.java:253)
at XMLEncoderBug$OwnEncoder.run(XMLEncoderBug.java:180)
"Signal Dispatcher" daemon prio=10 tid=0x009A5358 nid=0x70c waiting on monitor
[0..0]
"Finalizer" daemon prio=9 tid=0x0AA60EB8 nid=0xa54 waiting on monitor
[ad1f000..ad1fdb4]
at java.lang.Object.wait(Native Method)
- waiting on <02F63CF8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
- locked <02F63CF8> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0x0AA602A0 nid=0x6f4 waiting on monitor
[acdf000..acdfdb4]
at java.lang.Object.wait(Native Method)
- waiting on <02F63A70> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:426)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113)
- locked <02F63A70> (a java.lang.ref.Reference$Lock)
"VM Thread" prio=5 tid=0x009D7A98 nid=0xcd4 runnable
"VM Periodic Task Thread" prio=10 tid=0x009A4028 nid=0xe40 waiting on monitor
"Suspend Checker Thread" prio=10 tid=0x009A48F8 nid=0x680 runnable
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Test case in comments section...
---------- END SOURCE ----------
(Review ID: 181175)
======================================================================