When an exception kills a thread in a Group
Chris Vest
mr.chrisvest at gmail.com
Tue Jun 24 20:36:09 UTC 2014
Hi,
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).
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.
Cheers,
Chris
More information about the jmh-dev
mailing list