[
https://issues.apache.org/jira/browse/LUCENE-4987?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13697194#comment-13697194
]
Dawid Weiss commented on LUCENE-4987:
-------------------------------------
Mhmm... took them a while, don't you think? I mean:
{quote}
I think I found the reason. J9 seems to be optimizing away the following code:
[...]
{quote}
took me an hour or so to pinpoint this, even without access to the JIT's source
code :)
> 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: [email protected]
For additional commands, e-mail: [email protected]