JDK-8206267 : Unsafe publication of StubCodeDesc leads to crashes
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 8,9,10,11
  • Priority: P2
  • Status: Resolved
  • Resolution: Withdrawn
  • OS: generic
  • CPU: generic
  • Submitted: 2018-07-03
  • Updated: 2018-07-03
  • Resolved: 2018-07-03
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11Resolved
Related Reports
Relates :  
Description
The StubCodeDesc constructor is unsychronized. However, it runs when the C2 compiler thread is initializing. The compiler thread reads the StubCodeDesc list while it is in an unstable state, resulting in a read from an uninitialized pointer field and it then segfaults, causing the VM to abort.
Comments
There was also following fix which removed desc_for_index() JDK-8149741.
03-07-2018

I think I may have been mistaken. It looks like the adapters are now all generated before the OptoRuntime stubs. I really don't like the way this works, but I think it's not really a bug.
03-07-2018

It's quite hard to reproduce, and I haven't got an hs_err with JDK 12. I'll try to get a hs_err with JDK 12 to be certain.
03-07-2018

Okay, thanks for the information! ILW = Crash StubCodeDesc constructor, intermittent, no workaround = HLH = P2
03-07-2018

Sure. I reproduced it today with JDK head. The fix in http://hg.openjdk.java.net/jdk9/jdk9/hotspot/rev/30b120bce29d doesn't solve this problem. I'm surprised it wasn't noticed at the time: it seems obvious to me.
03-07-2018

This looks very similar to JDK-8138922. Can you reproduce the issue with JDK >= 9?
03-07-2018

It's a regression since invokedynamic.
03-07-2018

Andrew, could you please add more information to the bug (hs_err, affects version, ..)? Is this a recent regression?
03-07-2018