Friday, 15 March 2013

android - how to find out why the process is sleeping/blocked in linux -


Friends:

For some time we found that our program is run abnormally, i.e. It has not happened, but as we expect, this sleep is not coming!

Then, I want to know why this sleep is coming, like reading some socket is blocked? Some hints waiting blocking? Or other things happened to block this process.

How to do that? I can indicate PS or / proc / pid / statistics only its states and its mask mask. But I want to know more information which can block sockets, signals or other things?

Can someone give help information?

This is in Linux / Android, process is common, process, original or Java process.

thx from a very long time

If your system was blocked on the system call You can use strace to find out. Note that strace binary can not be installed on your Android system, but there is a version in the recent versions of busybox . In addition you may need root access, so you want to jailbase your Android device.

Here's a customized example.

  $ mkfifo / tmp / foo $ cat / tmp / FU & amp; Blocked "cat" process # block $ ps # notepip;  
  The procedure is attached to 29739 - In my case it is related to the process # 29739 $ sudo strace -p 29739 #   

In this case the production of strace is: ( "/ Tmp / foo", O_RDONLY ^ C

) will hang again with your process; Interrupt to break ctrl-c

  $ nc -l 8888 and [2] 31087 $ sudo strace -p 31087 process 31087 enclosed - to leave accept Inhibited (3,   

In this case you can know that it is trying to accept ; You can use the / proc filesystem for this :

  $ Ls -l / proc / 31087 / fd / 3 lrwx ------ 1 abliss abliss 64 Jun 25 12:22 / proc / 31087 / FD / 3 - & gt; ; Socket: [2265625]                  / html>

No comments:

Post a Comment