LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to know why an app is freezing (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-know-why-an-app-is-freezing-714391/)

htamayo 03-25-2009 01:23 PM

how to know why an app is freezing
 
hi, suddenly an app was freezing -noatun- i killed the process and then load it but always is freezing. now, I did tail | dmesg but nothing weird in it.

my question is: is there a way|command that help me to know why is it freeze? why killing the process and then load it doesn't work?

all the best

fpmurphy 03-25-2009 01:31 PM

When it freezes what is the process state shown by the ps utility? Sleeping, stopped, or what? man ps for information on how to get the process state.

htamayo 03-25-2009 01:40 PM

it's sleeping (S)

JaksoDebr 03-25-2009 03:29 PM

Does this happen also after a reboot? Killing a single process does not always kill everything related to an application. A single launch of Firefox, for example, has more than a single process running, and to kill it, you need to kill all related processes for a clean start.

Linux Archive

htamayo 03-25-2009 04:06 PM

in fact, I'm interesting in tracking all related process, maybe the reboot could be easier, but for me is a dark-side kind of solution, brute force, like windows style

jjuhl 03-25-2009 05:50 PM

A few utils for inspecting process state
 
There can be many reasons for a program to "hang".

Some of the utilities you can use to find out what's going on are;

'ps' - this will show you a list of running processes (you may want to run something like 'ps aux' to get more detail) including how much memory they use, what their current state is, their PID (process ID) etc etc. Can be very instructive.

Another good tool is 'top'. This will show you what processes are using a lot of CPU time, memory etc, show you the load of the system in general and various other details. It's a great way to get a snapshot look at how the system currently performs.

The 'vmstat' tool can show you details about memory use, page ins, page outs etc. You run it with an update frequency in seconds, like 'vmstat 3' and it then shows you a line with various details about the system memory utilization and more every <interval> seconds.

'sar' can be used to see how the system has performed over time.

If you want to see what a running process is currently doing, then strace, ltrace (or even gdb - the GNU debugger) are your friends. 'strace' will dump a log of the system calls the program is executing. 'ltrace' shows library calls the program is making. And 'gdb' is a interactive debugger allowing you complete inspection of the programs runtime state.
All 3 programs can be run as 'strace progname' to start <progname> under the tool, or you can use 'strace -p <pid>' to attach the tool to a running process id (same for ltrace and gdb).

You can also find various details by using 'ls -l' and 'cat' to view files in /proc/<pid_of_program>/

Read the 'man' pages for the tools I've mentioned and you should be well on your way to discovering why your programs "hang".

dv502 03-25-2009 10:56 PM

Here is a way to kill a process and its child processes.


Code:

pkill -P $( pgrep script )
Replace the red with the name of the script or the name of the program.

BTW, have you tried reinstalling the program or doing an upgrade?

Another good tool is called strace as mention above. Strace traces all the function calls of an application. Do a man strace or google for its usage.

Also do a memory test, some live CDs have this feature. If your memory is beginning to fail, this will cause freezes and other intermitted problems.




- Good luck


All times are GMT -5. The time now is 11:39 PM.