wood burning stoves*
The moose likes Threads and Synchronization and the fly likes Stuck Thread in RUNNABLE state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Stuck Thread in RUNNABLE state" Watch "Stuck Thread in RUNNABLE state" New topic
Author

Stuck Thread in RUNNABLE state

T. Huy Nguyen
Ranch Hand

Joined: Nov 02, 2010
Posts: 57
We observed this stuck thread in Production server. This is the second time I see something like this: A stuck thread with RUNNABLE state. I can't understand how that can happen.

The server is WebLogic server 10.3 running on Sun JVM.

Has anyone encountered a similar situation? Please share your finding. Many thanks in advance.



My material for SCJP (2008), SCWCD (2010), SCBCD (2010). About me
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18717
    
  40


Don't know if this is related, but you may want to synchronize that hashmap -- use Collections.syncrhonziedMap() on it.

http://www.coderanch.com/t/528711/threads/java/Hung-threads-caused-HashMap-dom

I have never seen it stuck in the put() method before, but as described in the other topic, I have seen it stuck in the get() method.

Henry

Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1760
    
    7

Yeah, the stuck thread issue in relation to java.util.HashMap did ring a bell here too.
There's a blog post somewhere that describes the race condition in its internal resize logic beautifully.
I'll try to find it.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1760
    
    7

Here we go: http://mailinator.blogspot.nl/2009/06/beautiful-race-condition.html
So the long and short of it is: HashMap is not and was never intended to be a thread-safe collection, so if you manipulate it from mulitple threads without proper synchronization, all bets are off.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stuck Thread in RUNNABLE state