JDK-8144212 : JDK 9 b93 breaks Apache Lucene due to compact strings
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux_ubuntu
  • CPU: x86_64
  • Submitted: 2015-11-28
  • Updated: 2016-03-03
  • Resolved: 2016-01-18
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 9
9 b105Fixed
Related Reports
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b93)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b93, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Linux serv1 3.19.0-33-generic #38~14.04.1-Ubuntu SMP Fri Nov 6 18:17:28 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

A DESCRIPTION OF THE PROBLEM :
When compact strings are enabled, Lucene tests fails reproducible. We don't know the exact cause, because Strings are used anywhere in the code, so it is not easy to reproduce isolated.

Running Lucene tests causes several tests of Lucene's core testsuite to fail.

REGRESSION.  Last worked in version 9

ADDITIONAL REGRESSION INFORMATION: 
worked with JDK 9 b90

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Checkout Apache Lucene Core from svn and bootstrap ivy:
$ svn co http://svn.apache.org/repos/asf/lucene/dev/trunk/lucene
$ cd trunk
$ ant ivy-bootstrap

Run tests in core module:
$ cd core
$ ant test

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Tests should pass (as they do with JDK 8 or JDK 9b90)
ACTUAL -
Several tests fail. The exact number of failing tests depends on randomization. To reproduce the same failure use the command line printed out on failure (including a random seed).

Please contact the Apache Lucene devlopment team (dev@lucene.apache.org or myself uschindler@apache.org) for help in reproducing. I will also hang on OpenJDK mailing list.

REPRODUCIBILITY :
This bug can be reproduced always.

CUSTOMER SUBMITTED WORKAROUND :
With compact strings disabled, tests pass as usual:

$ ant test -Dargs='-XX:-CompactStrings'


Comments
The problem is a missing membar after the _inflateStringC intrinsic, allowing a subsequent load from the destination array to flow above and return a wrong result (see Graph.png).
05-01-2016

I reproduced the problem and was able to write a simple regression test (TestStringGetChars.java). Investigating.
04-01-2016

Since this is appears to be a C2 compiler issue, reassigning to Tobias.
30-11-2015

Also reproduces with the latest jdk9/hs-comp in fastdebug. No asserts, just the test failures.
30-11-2015

I have reproduced it locally with Lucene core tests. The tests are passing with "-XX:TieredStopAtLevel=1", which points to C2 bug. Further eliminating C2 intrinsics from the run, managed to pass the tests with "-XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_inflateStringC". This means the bug is somewhere at LibraryCallKit::inline_string_copy.
30-11-2015