ReadWriteLock held by "Thread[null]"?
I have what appears to be a deadlock in my application, but the thread dumps don't indicate where it is.
There is a data structure that uses a ReentrantReadWriteLock, and readers get the read lock, while writers get the write lock.
When the problem occurs, it looks as though two threads are waiting for the readLock, implying that some other thread is holding the WriteLock. However, I can't find that thread (if it exists).
The stack dump for the relevant threads looks like this:
Thread[State Update Dispatch] - WAITING
Waiting for: java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@5b6d00
Held by: Thread[null]
Thread[State Update Log] - WAITING
Waiting for: java.util.concurrent.locks.ReentrantReadWriteLock$NonfairSync@5b6d00
Held by: Thread[null]
Both of these are waiting on a lock supposedly held by "Thread[null]", but there is no listing of any thread with a null name. I also cannot find any thread that appears to be in code that holds the write lock.
Questions:
1. Is a thread labelled "Thread[null]" some kind of special thread, or just a thread explicitly created with a null name?
2. Is it possible to misuse ReentrantReadWrite lock in such a way that two threads simultaneously calling for the readLock can lock each other out?
any feedback would be appreciated
Thanks,
Pat

