• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 159
  • Last Modified:

what is stuck threads?

What is stuck threads??

How to slove this ??
Sathish David  Kumar N
Sathish David  Kumar N
3 Solutions
A thread gets stuck when it cannot make progress on some task.

This could be due to a lot of potential reasons.

It could be a deadlock.  Say you have 2 threads A and B.  If A needs something from B and at the same time, B needs something from A - you can get a deadlock.  Neither can advance and both threads get stuck.

It could be stuck in some sort of infinite loop or waiting for some resource that is never available.

If you have no idea where it's getting stuck, you best hope is to attach a profiler, like visualvm:
(comes with the JDK) and use it to view the threads:
and dump a stack trace, which will show you want the stuck thread is trying to do and you may be able to figure it out from there.

It's not likely to be an easy problem to solve - these things are frequently complex.

Good luck - hope that helps,

mccarlIT Business Systems Analyst / Software DeveloperCommented:
It usually means threads that are in deadlock (or possibly livelock). Which is where two threads (or more) can't proceed because one it waiting on some the other thread has locked, but that other thread can't proceed because it is waiting on something that the first thread has locked.

As for how to solve it, well that depends mostly on the code that you are talking about. But in general, a good first principle is to ALWAYS lock resources in the same order.
Jeffrey Dake Senior Director of TechnologyCommented:
A technique I have seen as well is to find your Java process and do a "kill -quit" on the process. You will then get a thread dump that you could look into in your logs and try to figure out what the threads are doing  and why they might be stuck.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now