[ 
https://issues.apache.org/jira/browse/LUCENE-4987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13697199#comment-13697199
 ] 

Shai Erera commented on LUCENE-4987:
------------------------------------

Sigh ... what can I say? :)

I think it took them a while to understand why it's optimizing away. From what 
I understand, their code failed to check the method flags, in this case 
'synchronized' and therefore assumed this is just an empty override.
                
> Test framework may fail internally under J9 (some serious JVM 
> exclusive-section issue).
> ---------------------------------------------------------------------------------------
>
>                 Key: LUCENE-4987
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4987
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Dawid Weiss
>            Assignee: Dawid Weiss
>            Priority: Minor
>             Fix For: 5.0, 4.4
>
>         Attachments: j9.zip
>
>
> This was reported by Shai. The runner failed with an exception:
> {code}
> [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
> {code}
> The problem is that this is impossible because the code around 
> JUnit4.java:809 looks like this:
> {code}
>      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();
>             ...
>           }
>         }
>       });
> {code}
> and the contract on Guava's EventBus states that:
> {code}
>  * <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
> {code}
> 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.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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

Reply via email to