I think I know what this is... holy crap, the complexity of software
testing never ceases to amaze me. Uwe -- you'll like it ;)

So, the way my deduction was up till now was that if all forked JVMs
completed normally (with a "quit" event) then the slave's controller
just HAD to call System.exit() which in turn just HAD to terminate the
JVM...

What I forgot about is the freaking shutdown hooks! Take a look at
this stack trace:

[junit4:junit4] "main" prio=5 tid=0x00000008011e0000 nid=0x801007c00
in Object.wait() [0x00007fffffbfd000]
[junit4:junit4]    java.lang.Thread.State: WAITING (on object monitor)
[junit4:junit4]         at java.lang.Object.wait(Native Method)
[junit4:junit4]         at java.lang.Thread.join(Thread.java:1258)
[junit4:junit4]         - locked <0x00000008119b43f8> (a
org.eclipse.jetty.util.thread.ShutdownThread)
[junit4:junit4]         at java.lang.Thread.join(Thread.java:1332)
[junit4:junit4]         at
java.lang.ApplicationShutdownHooks.runHooks(ApplicationShutdownHooks.java:106)
[junit4:junit4]         at
java.lang.ApplicationShutdownHooks$1.run(ApplicationShutdownHooks.java:46)
[junit4:junit4]         at java.lang.Shutdown.runHooks(Shutdown.java:123)
[junit4:junit4]         at java.lang.Shutdown.sequence(Shutdown.java:167)
[junit4:junit4]         at java.lang.Shutdown.exit(Shutdown.java:212)
[junit4:junit4]         - locked <0x00000008150231c0> (a java.lang.Class for
java.lang.Shutdown)
[junit4:junit4]         at java.lang.Runtime.exit(Runtime.java:107)
[junit4:junit4]         at java.lang.System.exit(System.java:960)
[junit4:junit4]         at
com.carrotsearch.ant.tasks.junit4.slave.SlaveMain.main(SlaveMain.java:275)
[junit4:junit4]         at
com.carrotsearch.ant.tasks.junit4.slave.SlaveMainSafe.main(SlaveMainSafe.java:12)

Nice, isn't it? The JVM never quits because the shutdown hook from
jetty falls into a deadlock (most likely; my wild guess).

My resolutions in the order of preference:

1) change system.exit to runtime.halt call in randomized testing's
SlaveMain. Whether there is a finalization queue or shutdown handlers
-- we shouldn't care much. Alternatively, I can spin a System.exit and
then wait a bit in a background thread, then halt if this isn't
successful, but this seems dirty to me.

2) forbid adding shutdown hooks entirely. This won't solve the problem
because there's still finalization queue but it may detect places
where shutdown hooks are installed... it may be a problem for
zookeeper and jetty though (don't know how they'll react to us
forbidding shutdown hooks).

Dawid

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

Reply via email to