[concurrency-interest] Advice on tracking down the caller of Thread.interrupt()?
nathan.reynolds at oracle.com
Wed Mar 21 16:05:48 EDT 2012
Thread.interrupt() is a Java method. You could use BTrace to instrument
the method and print the call stack and thread interrupted and interruptee.
Consulting Member of Technical Staff | 602.333.9091
Oracle PSR Engineering <http://psr.us.oracle.com/> | Server Technology
On 3/21/2012 12:25 PM, Bryan Thompson wrote:
> I am curious if there are any tricks for tracking down the source of an interrupt. That is, the Thread which actually invoked Thread.interrupt() on some thread.
> We use a disk IO in a database with concurrent readers on a shared file. IO, of course, can be interrupted. And when it is interrupted the backing channel is closed, so we have to jump through hoops to ensure that the channel is reopened for those threads which see the AsynchronousCloseException (or ClosedChannelException), while ensuring that the thread which sees the ClosedByInterruptException terminates its activity.
> Normally I can spot the source of an interrupt by looking at the context in which the interrupt occurs and work backward through the logic of the application to figure out why the Thread might have been interrupted. However, this is difficult when our code is embedded into other applications when we have little to know idea what else might be going on. In particular, I am looking at an issue now where I think that the interrupt might be coming from some other component. For example, by holding onto a Thread reference beyond the life of a worker task and then interrupting that thread.
> Is it possible to somehow instrument the JVM to track and report the caller of Thread.interrupt()? Are there profilers which can do this? Can this be done somehow by registering a SecurityManager to log stack fames in Thread.checkAccess()?
> Thanks in advance,
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest