This test just started to fail with jdk8 ( failure NOT seen in jdk7 b146 ).
Previously the test only ever ran with 1 thread! The reason is that ThreadLocalRandom.current().nextInt(1, 10) always returned 1. Since the fix for 7051516: "ThreadLocalRandom seed is never initialized so all instances generate the same sequence", the test now actually is running with a number of threads between 1-10.
I believe the test is misguided. It has more threads simultaneously arriving than registered parties. There is a race; In thread A the final party arrives, it does some internal state processing for the phaser, onAdvance, increment phase number, etc. Another thread may invoke arrive() while thread A is doing this, it will find that the unarrived count is -1 ( unarrived = (counts & UNARRIVED_MASK) - 1; ) and throw IllegalStateException.
I believe this to be a test problem/usage error because of the arrive() specification:
"It is a usage error for an unregistered party to invoke this method. However, this error may result in an IllegalStateException only upon some subsequent operation on this phaser, if ever."