Firefox is hung. Usually I kill it with -1, -9 or -15, but this time, dang it, I want to find out why. I have an hour or so to waste on this, and seek education above actually solving the problem.
Goal: get this instance of firefox running again, without killing it and restarting.
Firefox was working fine, though sluggish due to heavy memory usage. I had Avogadro's number of tabs open in about a thousand browser windows. (Some exaggeration may be involved.) I was closing some tabs, when at one point the browser window stopped repainting their contents. Dragging unrelated windows over causes remnants of those windows to sit there forever. Whatever is the X11 equivalent of WM_PAINT, it's being ignored. Attempts to fire up a new Firefox by clicking on URLs in emails bring up only an error popup saying "Firefox is already running, but is not responding."
Firefox has process ID 9297.
Process 526 is the windows manager.
=> ps axl | grep 9297
0 1000 9297 526 13 -7 6080428 4465776 poll_s S<sl ? 11602:12 firefox
0 1000 20000 9297 20 0 0 0 exit Z ? 216:31 [plugin-containe] <defunct>
(I was playing with renice to see if priority had anything to do with firefox hanging. Nope. But I left it at -7.)
=> ps -efL | grep 9297
darenw 9297 526 9297 57 61 Sep22 ? 6-23:10:34 firefox
darenw 9297 526 9300 0 61 Sep22 ? 00:00:00 firefox
darenw 9297 526 9301 0 61 Sep22 ? 00:00:00 firefox
... dozens like these ...
darenw 9297 526 7607 0 61 16:17 ? 00:00:00 firefox
darenw 9297 526 7657 0 61 16:17 ? 00:00:00 firefox
darenw 20000 9297 20000 1 1 Sep23 ? 03:34:36 [plugin-containe] <defunct>
=> ps axl | grep 20000
0 1000 20000 9297 20 0 0 0 exit Z ? 216:31 [plugin-containe] <defunct>
This one lingers because the main thread 9297 hasn't yet finished off that thread by obtaining its exit code. At least, that's my understanding of "defunct" processes. I'm not sure how to investigate this detail further, or how to determine if this is why Firefox is hung.
=> strace -f -p 9297
...
[pid 13945] <... select resumed> ) = 0 (Timeout)
[pid 13945] select(0, NULL, NULL, NULL, {0, 10000}) = 0 (Timeout)
[pid 13945] select(0, NULL, NULL, NULL, {0, 10000} <unfinished ...>
[pid 9356] <... futex resumed> ) = -1 ETIMEDOUT (Connection timed out)
[pid 9356] futex(0x7f28b7df8be8, FUTEX_WAKE_PRIVATE, 1) = 0
[pid 9356] futex(0x7f28b7df8c14, FUTEX_WAIT_BITSET_PRIVATE, 1, {6910910, 806929252}, ffffffff <unfinished ...>
...
Same six lines repeat for as long as I let strace run, though sometimes there's only two instead of three lines for either PID. I didn't see any mention of other pids, besides these two.
=> ps axl | grep 13945
4 0 4985 23253 20 0 11064 2236 pipe_w S+ pts/19 0:00 grep 13945
=> ps axl | grep 9356
4 0 5111 23253 20 0 11064 2232 pipe_w S+ pts/19 0:00 grep 9356
So what are these two processes, 13945 and 9356?
=> ps -eL | grep 9297 |grep 9356
9297 9356 ? 02:02:50 SoftwareVsyncTh
9297 13945 ? 01:04:15 firefox
So what is SoftwareVsyncTh? Google does not help much. This symbol appears in 'ps' output and other listing of processes and threads, but not in any online source code, or Q&A forums mentioning it in a specific way. For all I know, it, and these two processes, have nothing to do with Firefox being stuck and not painting its windoes.
What further commands could I use to uncover more clues? Is there a way to get a list of windows and tabs with their urls, and close one (the most suspicious/spammy looking url) from a shell command line?
Well, whatever is going on with those, I find I can get some info on the main thread:
=> strace -p 9297
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=9297, si_uid=1000} ---
rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
poll([{fd=23, events=POLLPRI|POLLOUT}], 1, 5000) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
which repeats over and over with no changes.
I am not a genius at threads, processes, mutexes and futexes and all that, but maybe by solving this mystery, I'll become one! I just need to know more commands for investigating further, and understanding of what exactly is going on in the strace results which may relate to the hangedness of Firefox.
Are there any command I could try, to kick Firefox back into action?
System specs: quad core Intel something, 16GB, Arch Linux last updated about a month or two ago. Using icewm, multiple workspaces and many text editors, PDF viewers, browsers and whatever open. Running conky to show RAM and swap usage in upper left corner of screen. I'm usually on the verge of going into swap.