Google
 

« ASRG rechartered         The recent blooming of anti-spam group (must be the weather?) »

A copy of the String bug we found

Posted January 12, 2004 – 3:48 pm by Yakov Shafranovich in Programming

A copy of the bug report we submitted to Sun is included here for the curious: (its long and nasty)


release: 1.4.2
hardware: x86
OSversion: Linux
synopsis: ArrayOutOfBounds Exception on LinkedList with Mutliple Thread WITH -server
description: FULL PRODUCT VERSION :
Tested VMs:
* 1.4.1_03-b02 - does not fail
* 1.4.2_02-b03 - fails
* 1.4.2_02-b28 - fails
* 1.4.2_03-b02 - fails

FULL OS VERSION :
Redhat Linux 8, kernel v 2.4.24
Windows 2000 SP2
Windows XP SP1

EXTRA RELEVANT SYSTEM CONFIGURATION :
Tested hardware:
* Linux - Desktop Intel P-II 333Mhz
* Windows 2000 - Desktop AMD Athlon
* Windows XP - AMD Athlon

A DESCRIPTION OF THE PROBLEM :
When operating on LinkedLists in a multithread environment such as a J2EE server (JBoss in our case),
with the “-server” option turned on, there the toArray(Object []) method of the LinkedList class throws
occasional ArrayOutOfBounds errors. There are no synchronization issues since the variables are local to
each thread. This problem DOES NOT happen on the “-client” HotSpot VM. This error DOES NOT OCCUR
on JVM 1.4.1 under Linux.

In our understanding of the server VM document (http://wwws.sun.
com/software/solaris/java/wp-hotspot/#pgfId=1082013), this can be related to the following optimization:

“Range check elimination — The Java programming language specification requires array bounds checking
to be performed with each array access. An index bounds check can be eliminated when the compiler can
prove that an index used for an array access is within bounds.”

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Have multiple threads operate on local LinkedList variables USING the toArray method

EXPECTED VERSUS ACTUAL BEHAVIOR :

EXPECTED -
No errors

ACTUAL -
The following exception is thrown very often:

 java.lang.ArrayIndexOutOfBoundsException: 591
         at java.util.LinkedList.toArray(LinkedList.java:657)
         at Test$RunThread.run(Test.java:153)ERROR MESSAGES/STACK TRACES THAT OCCUR :
 java.lang.ArrayIndexOutOfBoundsException: 591
         at java.util.LinkedList.toArray(LinkedList.java:657)
         at Test$RunThread.run(Test.java:153)

REPRODUCIBILITY :
This bug can be reproduced always.

Tags: , ,

Permalink | Trackback URL | This post has

Sorry, comments for this entry are closed at this time.