When an exception kills a thread in a Group
Aleksey Shipilev
aleksey.shipilev at oracle.com
Wed Jun 25 08:28:54 UTC 2014
Hi Chris,
On 06/25/2014 12:36 AM, Chris Vest wrote:
> I just had a head-scratchy 30 minutes that could have been avoided if
> stack traces had been eagerly printed when an exception kills a
> thread that is part of a @Group (I haven’t checked if it’s the same
> for ordinary non- at Group worker threads).
They are supposed to be printed early if once benchmark thread fails.
However, there might be corner cases when one thread is failing and
exiting the sync iteration loop, and all other threads are stuck then.
We try to recover in those cases, but it might be not enough.
> I had accidentally put a ThreadLocalRandom.current().next(0) in one
> of my benchmark methods, right after taking a write lock on a
> StampedLock that I foolishly didn’t unlock in a finally-clause. The
> next(0) threw an exception and killed the thread, leaving the lock
> taken, while the other threads in the group quickly got stuck waiting
> for that lock. The exception from next(0) was never printed to my
> console for some reason, leaving me quite puzzled as to what was
> going on.
A simple reproducer would be nice.
-Aleksey.
More information about the jmh-dev
mailing list