The Spring application starts hang and resides. How can you quickly determine which thread is causing hang?

Let me ask you a question : if you have just taken over a strange Spring application, the hang stops during startup, and the Spring container does not start or fail, so the hang is there all the time. There is no obvious error log in the business log (it can be determined that it is caused by external dependencies), and more is the normal log of some middleware systems, so how to locate what caused the startup failure?

my attempt : 1. Try to find clues through the log (searched the basic log and found no obvious error) 2. Several thread dump attempts to see if there are obvious deadlocks, blocking thread problems (failure) 3, continue thread dump attempts to find the cause of hang
my experience: hang may need to download something for a long time, but has been unable to download it (may be due to network, memory, etc.); external dependencies have been retrying without a timeout circuit breaker.

my question : in the third attempt, because a complex system will rely on a variety of external systems such as middleware, the spring container has already loaded part of the bean, so there will be a variety of threads in thread dump in different states. How can a new system quickly determine which thread is causing hang? Of course, it may be faster to have a lot of experience or be familiar with the system.

of course, many people"s answers are case-by-case analysis, but what experiences can you share?


1, jps
2, jstack pid

look at what the threads are doing

Menu