Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When an application (thunderbird) has a problem, sometimes it goes into an unresponsive state where it has blocked the UI, is blocking login processes (at tty terminals) and also is preventing a restart of the X session using Ctrl-Alt-Backspace.

Normally on a *nix box, sending a signal to the process is enough to give me back enough access to regain control, however in this case everything was borked, even though it was only a single application using a great deal of RAM and swap.

Using Ctrl-Alt-F1 gave me a console and a login prompt, and I could enter the root username, but it wouldn't return the password prompt, so I was stuck.

Ctrl-Alt-Backspace caused a restart of the X session, but it didn't give me a login prompt and a power-cycle was necessary.

Is there some way to bind a keystroke to some sort of low level "interrupt function" (I mean that in the general sense) to suspend the bothersome hung process so I can see what it is trying to do using strace?

I am vaguely aware that some blocked processes can't be suspended until they have returned, but in this case there is no indication that the blocking process is being prevented from accessing any IO resources, it just appears to be doing something dumb.

I was originally thinking of some bash script to ionice and renice any process associated with thunderbird to the lowest priority, but I imagine that if things are as bad as they seem, then the new process would not be able to get on the CPU.

I would like to use the Ctrl-Break key for this, as it isn't used for anything else during desktop sessions on my machine.

Basically, the desktop is (slowly) responding to key and mouse, so there is some scope to get commands run to cause the bad process to suspend, I just don't know what sort of commands are available in this scenario.

share|improve this question

migrated from serverfault.com Nov 23 '11 at 22:44

This question came from our site for professional system and network administrators.

    
Why not simply kill the Thunderbird process? –  voretaq7 Nov 23 '11 at 19:40
    
if i could get a prompt and the ps id of the process, I would do. in fact I would renice it, or suspend it. But the desktop is in a really bad way with no new processes being started. I suspect if I had a logged in session in one of ctrl-alt F2-6 consoles I might have been able to kill the process. sadly I did not. some data was lost. –  Tom H Nov 23 '11 at 22:20

3 Answers 3

My guess is that Thunderbird is consuming a lot of memory. If you can get a shell/console than just kill the process. Typically, thunderbird will hang if you are rebuilding the search index or loading thousands of emails in cache.

You can also set the priority on the linux oom killer in /proc so that the first thing to SIGTERM.

let's first find the process of thunderbird. (use what ever you prefer: pgrep, ps -ef|grep …, etc)

bash$ pidof thunderbird
1439

Now to temporarily stop the process, you just well, stop the process :)

bash$ kill -s SIGSTOP 1439
bash$ strace ... 

Once you are happy, you can continue the process, with well, "continue" signal. :)

bash$ kill -s SIGCONT 1439

ALso, if it is a thread you can look into using, tkill or tgkill but you may have to install that first.

share|improve this answer
    
that looks good for investigating the problem, and I can definitely make it do it again, I tried to delete the contents of a cached IMAP folder with 20K emails in it, so I would just try that again. in today's case I couldn't even get a command prompt –  Tom H Nov 23 '11 at 22:24
    
I suspect that if I had a logged in terminal in on of the other ttys ctrl-alt F2-F6 I could have used that. I'll looksee if that is possible to automatically drop to some "logged in" console that X must be running in. –  Tom H Nov 23 '11 at 22:27
    
there look to be a bunch of commands that are available to get back control using the SysRq key; en.wikipedia.org/wiki/Magic_SysRq_key so I am going to print that doc out and leave it by the computer for the next time. –  Tom H Nov 23 '11 at 23:34

I am don't know if it's going to answer in all of the details of your question but some hints it's going to give you.

when i am try the know what is the root cause of some program to misbehave is to run it from the console (i mean you run the GUI program but you start it from the console) so that you have some indication on what it is doing, hence you could get a clue on how to resolve the issue with thunderbird.

to be more specific to your question, what i am doing when i have situation like you mention, i ssh into the machine (yes i can login into, although i can't even get tty1 with Alt+F4), then with top, or with ps ax | grep thunderbird kill the program and the desktop (including X and every other window that was open) is back to live.

I know that it isn't touch exactly in the right spots you have draw in your question, but i give what i have.

share|improve this answer
    
yeah, trying an ssh was an option. But given that I couldn't get a local console to process a login, ie using PAM auth, then I'm pretty sure the ssh session was not going to get through authentication either. –  Tom H Nov 23 '11 at 22:34
    
@TomH It's worth a try. I have been able to ssh into highly wedged boxes before, though I have never experienced exactly the behavior you describe. –  dmckee Nov 24 '11 at 16:24

I suspect there are some issues with your analysis. Are you really still running a single core CPU? I suspect that either something more fundamental than a runaway process is occurring (on a single core box) although it is possible that something is causing the system to run very slowly.

Of course that you can't get access to run any diagnostics once the problem has kicked in doesn't help.

I'd go with disabling ACPI/APM (in case there's some contribution from clock scaling) and running procmon to try to capture the event.

You might consider using watchdog in monitoring only mode (-q) to trigger diagnostics.

share|improve this answer
    
no dual core. The CPU remark was wrong, as clearly other processes are getting time, but as I can't login at the console it suggests that PAM cannot make its IO call to lookup the password, or something like that. –  Tom H Nov 24 '11 at 23:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.