LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   strace crashes shell/system when being used on current bash (https://www.linuxquestions.org/questions/linux-software-2/strace-crashes-shell-system-when-being-used-on-current-bash-885275/)

Valentin 06-08-2011 04:01 PM

strace crashes shell/system when being used on current bash
 
Good evening,

I hope this is the adequate sub forum and I found a good thread title.

My apologies if it is somehow misleading. I have to admit that I do better in describing an issue in my native language, German.

Well, to the topic: I am observing a very strange behavior when using strace and don't know the reasons for it.

I do:
pstree -Aapnul |less -p bash
on my Ubuntu VM which is run with the help of Virtual Box.

I see:

|-gnome-terminal,1418,valentin
| |-gnome-pty-helpe,1419
| |-bash,1420
| | |-pstree,1471 -Aapnul
| | `-less,1472 -p bash
| `-{gnome-terminal},1421


I was curious: What would it look like to strace gnome-terminal and see what this process is doing?
I know, this is senseless and just playing around, but at the same time, it should work. Right?

Well, as a normal user I run:
strace -p 1418

-> And suddenly the windows showing the "terminal" freezes. It becomes grey and does not respond.
When I try to run another terminal, the windows will never appear and nothing happens. The whole machine behaves strangely and gets slowed down.

I am able to reproduce this problem as often as I like on this machine.

When I ran this strace command as root once, the whole system froze. Unfortunately I am not able to reproduce this one and prove it to you.

Now my question is: What happens there, why does it happen and is there any logic I am not aware of? Like there is a sort of "loop" or an unwritten rule that you may never ever trace your own "terminal"?

Ubuntu version: 10.04 (Lucid Lynx)
Kernel: 2.6.32-24-generic #43-Ubuntu
strace version: 4.5.19-2
Desktop: gnome


Best regards,
Valentin

rayfordj 06-08-2011 09:14 PM

If you are attempting to strace the shell you are launching strace it end up in a loop which will consume resources and [potentially] render a system inoperable.

What happens if you launch two shells and strace shellA from shellB?


All times are GMT -5. The time now is 11:40 AM.