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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bde3f7-31403.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bde3f7-31403.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?