How Do You Troubleshoot a Process in Linux That Seems to Hang Forever?

Problem scenario
You have a long-running process that seems to not be progressing.  The problem is reoccurring.  How do you troubleshoot it?

Possible solution #1
Start a duplicate terminal session.  Use "sudo ps -evf | grep foobar" where "foobar" is the name of the process.  Try the "top" command to see if the are memory or CPU constraints.  Other commands that may be useful are: stracedbuxlsof (list open files), sar (system activity report)

Possible solution #2
Reboot the server and try again.

Possible solution #3
Scroll down.  Sometimes a terminal appears to be at the very bottom, but you may have accidentally scrolled up to view something, and what appears to be hanging is not hanging.

Possible solution #4
Is there a deadlock happening?  If two processes are started and will not stop until the other one is complete, then they may stay active.  You may need to manually intervene.  Suspending or interrupting a process may be in order.  Is it possible that another administrator is suspending the process?  To learn more about managing suspended Linux commands, see this link.

Possible solution #5
If for security reasons you cannot create a duplicate session and the other suggestions above did not work, can you set up a monitoring solution?  Using Dynatrace, Zabbix, or Nagios can help you look into the details of the problematic server.  See these postings for how to set up a monitoring solution and an agent:

Leave a comment

Your email address will not be published. Required fields are marked *