LWN.net Logo

Advertisement

E-Commerce & credit card processing - the Open Source way!

Advertise here

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 19, 2007 21:08 UTC (Mon) by foo (guest, #1117)
Parent article: CLI Magic: Linux troubleshooting tools 101 (Linux.com)

I recently had my Firefox session lock up while I had a fairly
long email in a text area, which I didn't want to lose.
I did a "gdb /path/to/firefox-bin [FIREFOX-PID]", forced it
to return from the routine it was stuck in, exited the debugger,
and everything was back to normal.

Sometimes it's good being a nerd. :)


(Log in to post comments)

Impressive!

Posted Feb 20, 2007 1:47 UTC (Tue) by pr1268 (subscriber, #24648) [Link]

Thanks, foo, for the suggestion! I've never tried what you just mentioned, but it seems like a nice way to force errant apps to behave. (Not that this happens that often to me running Linux.)

I've been hacking Linux for about 9 years, exclusively for almost 3, and yet I'm always learning something new about it.

Oh, and one more slightly off-topic idea: Try doing foo's method to $HUNG_PROCESS in Windows. :-D

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 2:30 UTC (Tue) by Ross (subscriber, #4065) [Link]

How did that work when there were file descriptors open (including the connection to the X server)? It seems like you would have to reopen them manually and restore any state (like authentication with the server or refilling any open pipes).

If you always start Firefox under gdb then it's a different story :)

-Ross

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 6:23 UTC (Tue) by donio (subscriber, #94) [Link]

He attached gdb to the running process by specifying the pid as the
second argument to gdb.

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 14:46 UTC (Tue) by foo (guest, #1117) [Link]

Exactly. If you give gdb a second argument that's not
a core file, he'll interpret it as a PID and attach
to it. When you exit gdb, he detaches and everything's
copacetic.

If you just want to see where a process is spending time,
doing an "strace -p PID" can attach to a running process,
and later detaches properly with a Ctrl-C.

And to be fair with the comment above, I'm sure you can do
the same thing under Windows, if you have a debugger
installed.

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 16:24 UTC (Tue) by Ross (subscriber, #4065) [Link]

Ah, I misread "lock up" as "crashed". I often have the latter problem, especially when trying to save a link in Firefox, but haven't seen too many lockups.

-Ross

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 22:45 UTC (Tue) by Los__D (subscriber, #15263) [Link]

I have a feeling that you are not a Flash user :)

At least under my Ubuntu installation, the Flash player has a habit of locking Firefox quite hard, especially when sound is involved.

CLI Magic: Linux troubleshooting tools 101 (Linux.com)

Posted Feb 20, 2007 21:37 UTC (Tue) by robert_s (guest, #42402) [Link]

You are so lucky that worked.

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.