Uwe Schindler created SOLR-8874:
-----------------------------------

             Summary: Add fixes and workaround for Java 9 Jigsaw (Module 
System) to Solr tests
                 Key: SOLR-8874
                 URL: https://issues.apache.org/jira/browse/SOLR-8874
             Project: Solr
          Issue Type: Test
          Components: Tests
    Affects Versions: 6.0
            Reporter: Uwe Schindler
            Assignee: Uwe Schindler
            Priority: Critical


We now have one more week to prepare our build for Java 9 Jigsaw. The next Java 
9 EA build will now contain the new Java 9 module system. From that time on, it 
is no longer possible to test Java 9 unless we fix remaining bugs. Currently 
Solr does not pass at all, because almost every test fails because the 
RAMUsageEstimator tries to look into objects in static field where the 
internals were hidden by Java 9:

{noformat}
   [junit4] ERROR   0.00s | SolrRequestParserTest (suite) <<<
   [junit4]    > Throwable #1: java.lang.IllegalStateException: Unable to 
access 'private final sun.nio.fs.WindowsFileSystem sun.nio.fs
.WindowsPath.fs' to estimate memory usage
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([C6C2FAD07A66283B]:0)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator.createCacheEntry(RamUsageEstimator.java:602)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator.measureSizeOf(RamUsageEstimator.java:545)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator.sizeOfAll(RamUsageEstimator.java:387)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.StaticFieldsInvariantRule$1.afterAlways(StaticFieldsInvariantRule.j
ava:127)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:43)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
   [junit4]    >        at 
org.apache.lucene.util.TestRuleAssertionsRequired$1.evaluate(TestRuleAssertionsRequired.java:53)
   [junit4]    >        at 
org.apache.lucene.util.TestRuleMarkFailure$1.evaluate(TestRuleMarkFailure.java:47)
   [junit4]    >        at 
org.apache.lucene.util.TestRuleIgnoreAfterMaxFailures$1.evaluate(TestRuleIgnoreAfterMaxFailures.java:64)
   [junit4]    >        at 
org.apache.lucene.util.TestRuleIgnoreTestSuites$1.evaluate(TestRuleIgnoreTestSuites.java:54)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.StatementAdapter.evaluate(StatementAdapter.java:36)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.ThreadLeakControl$StatementRunner.run(ThreadLeakControl.java:367)
   [junit4]    >        at java.lang.Thread.run(java.base@9-ea/Thread.java:804)
   [junit4]    > Caused by: java.lang.reflect.InaccessibleObjectException: 
Unable to make member of class sun.nio.fs.WindowsPath access
ible:  module java.base does not export sun.nio.fs to unnamed module @436813f3
   [junit4]    >        at 
sun.reflect.Reflection.throwInaccessibleObjectException(java.base@9-ea/Reflection.java:420)
   [junit4]    >        at 
java.lang.reflect.AccessibleObject.checkCanSetAccessible(java.base@9-ea/AccessibleObject.java:174)
   [junit4]    >        at 
java.lang.reflect.Field.checkCanSetAccessible(java.base@9-ea/Field.java:170)
   [junit4]    >        at 
java.lang.reflect.Field.setAccessible(java.base@9-ea/Field.java:164)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator$3.run(RamUsageEstimator.java:597)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator$3.run(RamUsageEstimator.java:594)
   [junit4]    >        at 
java.security.AccessController.doPrivileged(java.base@9-ea/Native Method)
   [junit4]    >        at 
com.carrotsearch.randomizedtesting.rules.RamUsageEstimator.createCacheEntry(RamUsageEstimator.java:594)
   [junit4]    >        ... 13 more
   [junit4] Completed [1/1 (1!)] in 8.46s, 12 tests, 1 error <<< FAILURES!
{noformat}

I have 2 suggestions:
- for now disable the static heap usage checks for Java 9 (how? See below!)
- fix the problems! Mainly we have to ensure that *all* static, non-final 
fields in tests pointing to Java obects are nulled on tear down (@AfterClass).

I have no idea how to do the disabling conditionally. Maybe Dawid Weiss can 
give a hint.

In addition, almost every Hadoop test fails with Java 9 module system! Unless 
Hadoop fixes this and we have updated libs, our only chance is to disable all 
hadoop related stuff with Java 9 preview builds - sorry. I'd like to add a new 
Test annotation {{@DisableWithJava9Jigsaw}}, which disables the test if running 
under Java 9 Jigsaw.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to