Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-4987

Test framework may fail internally under J9 (some serious JVM exclusive-section issue).

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 4.4, 6.0
    • None
    • None
    • New

    Description

      This was reported by Shai. The runner failed with an exception:

      [junit4:junit4] Caused by: java.util.NoSuchElementException
      [junit4:junit4]         at java.util.ArrayDeque.removeFirst(ArrayDeque.java:289)
      [junit4:junit4]         at java.util.ArrayDeque.pop(ArrayDeque.java:518)
      [junit4:junit4]         at com.carrotsearch.ant.tasks.junit4.JUnit4$1.onSlaveIdle(JUnit4.java:809)
      [junit4:junit4]         ... 17 more
      

      The problem is that this is impossible because the code around JUnit4.java:809 looks like this:

           final Deque<String> stealingQueue = new ArrayDeque<String>(...);
           aggregatedBus.register(new Object() {
              @Subscribe
              public void onSlaveIdle(SlaveIdle slave) {
                if (stealingQueue.isEmpty()) {
                  ...
                } else {
                  String suiteName = stealingQueue.pop();
                  ...
                }
              }
            });
      

      and the contract on Guava's EventBus states that:

       * <p>The EventBus guarantees that it will not call a handler method from
       * multiple threads simultaneously, unless the method explicitly allows it by
       * bearing the {@link AllowConcurrentEvents} annotation.  If this annotation is
       * not present, handler methods need not worry about being reentrant, unless
       * also called from outside the EventBus
      

      I wrote a simple snippet of code that does it in a loop and indeed, two threads can appear in the critical section at once. This is not reproducible on Hotspot and only appears to be the problem on J9/1.7/Windows (J9 1.6 works fine).

      I'll provide a workaround in the runner (an explicit monitor seems to be working) but this is some serious J9 issue.

      Attachments

        1. j9.zip
          2.22 MB
          Dawid Weiss

        Activity

          People

            dweiss Dawid Weiss
            dweiss Dawid Weiss
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: