Multithreaded code hangs when JIT compiler kicks in

Originator:thierry.monney
Number:rdar://10174620 Date Originated:23-Sep-2011 02:49 PM
Status:Open Resolved:
Product:Java Product Version:1.6.0_26-b03-383-11A511
Classification:Crash/Hang/Data loss Reproducible:Always
 
23-Sep-2011 02:49 AM Thierry Monney:
'AtomicIntegerArray.java' was successfully uploaded

23-Sep-2011 02:49 AM Thierry Monney:
Summary:

The attached JUnit test case systematically hangs when run with the current OSX Lion Java VM (1.6.0_26-b03-383-11A511) and JIT compilation enabled.

Steps to Reproduce:

Compile the attached source files with the command
> javac *.java

Run with
> java -cp . AtomicIntegerArrayTest

Expected Results:

The program ends normally with the following output:
> Running test
> Test done

Actual Results:

The program hangs with the following output:
> Running test

At this point, the process freezes and cannot even be killed with Ctrl-C. One has to "kill -9" it. It is also impossible to run it in debug mode, e.g. in Eclipse, or to get a thread dump with jstack or attach to the process with JVisualVM.

Regression:

The program terminates normally when the SIZE constant is set to a smaller number (on my machine, 10000 runs fine but 30000 hangs).
The program also runs fine with greater numbers if JIT is disabled, running it with the command
> java -cp . -Djava.compiler=NONE AtomicIntegerArrayTest
It also runs normally with the same JVM version on Windows 7 and with prior JVM versions on OS X Lion (tested with 1.4.2_21-b01-324 and 1.5.0_19-b02-304).

Notes:

The problem is most likely related to JIT compilation for the following reasons:
- Normal Java diagnostic tools are useless, which indicates the VM itself may be corrupted
- The program runs fine with smaller numbers, probably because JIT has not run yet
- The program runs fine when JIT is disabled




23-Sep-2011 02:50 AM Thierry Monney:
'AtomicIntegerArrayTest.java' was successfully uploaded

23-Sep-2011 03:04 PM Thierry Monney:
Actually the test case does not use JUnit, but the point remains the same.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!