Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stuck Thread in RUNNABLE state

 
T. Huy Nguyen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Henry Wong
author
Marshal
Pie
Posts: 20893
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic