Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging utilities for Linux process hang issues?

I have a daemon process which does the configuration management. all the other processes should interact with this daemon for their functioning. But when I execute a large action, after few hours the daemon process is unresponsive for 2 to 3 hours. And After 2- 3 hours it is working normally.

Debugging utilities for Linux process hang issues?

How to get at what point the linux process hangs?

like image 593
Niranjan Avatar asked Jun 14 '10 05:06

Niranjan


2 Answers

  • strace can show the last system calls and their result
  • lsof can show open files
  • the system log can be very effective when log messages are written to track progress. Allows to box the problem in smaller areas. Also correlate log messages to other messages from other systems, this often turns up interesting results
  • wireshark if the apps use sockets to make the wire chatter visible.
  • ps ax + top can show if your app is in a busy loop, i.e. running all the time, sleeping or blocked in IO, consuming CPU, using memory.

Each of these may give a little bit of information which together build up a picture of the issue.

When using gdb, it might be useful to trigger a core dump when the app is blocked. Then you have a static snapshot which you can analyze using post mortem debugging at your leisure. You can have these triggered by a script. The you quickly build up a set of snapshots which can be used to test your theories.

like image 111
Peter Tillemans Avatar answered Sep 17 '22 17:09

Peter Tillemans


One option is to use gdb and use the attach command in order to attach to a running process. You will need to load a file containing the symbols of the executable in question (using the file command)

like image 39
Yann Ramin Avatar answered Sep 17 '22 17:09

Yann Ramin