Sometimes after a reboot, firefox launches into the wrong profile and seemingly changes the default profile. So I goto about:profiles, select the profile funnily named default which is no longer the real default, “Set profile as default” and “launch profile in new browser” or whatever it says. So it launched my default profile and with no tabs, proceeds to sit at 100% CPU usage for a few minutes. Exiting the firefox window left the process running. Killing pkill firefox and restarting presented the same issue. I then perf record $(pgrep firefox) and perf report > perf.report to get

     7.80%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000dfcb1
     2.73%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000c69d5
     2.59%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a4a61
     2.13%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a39e7
     2.01%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a39d2
     1.87%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a449b
     1.70%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a5852
     1.52%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a3aeb
     1.45%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a449f
     1.43%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a5875
     1.42%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a44a6
     1.23%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a586f
     1.14%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a586b
     1.10%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a39e0
     1.07%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000dfcc4
     1.03%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a4a85
     1.00%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a39cc
     0.99%  BgIOThr~Pool #3  libmozsqlite3.so         [.] 0x00000000000a44b7
     ...

And

grep libmozsqlite perf.report | awk '{sum+=$1;}END{print sum;}'

tells us 99.64% of samples were somewhere in libmozsqlite3. So I assume something weird was going on with a database and maybe it was deadlocked.

I then tried to discover what file it was using with lsof $(pgrep firefox) | grep sqlite

firefox 6972 andrew  mem-r     REG              253,2     32768  132316 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite-shm
firefox 6972 andrew  mem-r     REG              253,2     32768  147474 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage-sync-v2.sqlite-shm
firefox 6972 andrew  mem       REG              253,0   1416120  268758 /usr/lib64/libsqlite3.so.0.8.6
firefox 6972 andrew  mem       REG              253,0   1336496  658181 /usr/lib64/firefox/libmozsqlite3.so
firefox 6972 andrew   17uw     REG              253,2   1572864  131293 /home/andrew/.mozilla/firefox/qe5rlihv.default/cookies.sqlite
firefox 6972 andrew   47uw     REG              253,2    869888  131322 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage.sqlite
firefox 6972 andrew   50uw     REG              253,2    196608  131303 /home/andrew/.mozilla/firefox/qe5rlihv.default/permissions.sqlite
firefox 6972 andrew   53u      REG              253,2    524704  132444 /home/andrew/.mozilla/firefox/qe5rlihv.default/cookies.sqlite-wal
firefox 6972 andrew   88rw     REG              253,2  36700160  131305 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite
firefox 6972 andrew   90uw     REG              253,2    229376  131241 /home/andrew/.mozilla/firefox/qe5rlihv.default/content-prefs.sqlite
firefox 6972 andrew   93u      REG              253,2   2393848  137142 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite-wal
firefox 6972 andrew   94rw     REG              253,2  43876352  135062 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite
firefox 6972 andrew   95u      REG              253,2    327952  137444 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite-wal
firefox 6972 andrew   96uw     REG              253,2    688128  131474 /home/andrew/.mozilla/firefox/qe5rlihv.default/formhistory.sqlite
firefox 6972 andrew   98uw     REG              253,2  36700160  131305 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite
firefox 6972 andrew   99u      REG              253,2   2393848  137142 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite-wal
firefox 6972 andrew  100uw     REG              253,2  43876352  135062 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite
firefox 6972 andrew  101u      REG              253,2    327952  137444 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite-wal
firefox 6972 andrew  103rw     REG              253,2  36700160  131305 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite
firefox 6972 andrew  104u      REG              253,2   2393848  137142 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite-wal
firefox 6972 andrew  105rw     REG              253,2  43876352  135062 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite
firefox 6972 andrew  106u      REG              253,2    327952  137444 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite-wal
firefox 6972 andrew  109uw     REG              253,2    163840 5508192 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage/default/moz-extension+++4d415bf4-02ea-4210-9a68-1029f7d01b76/ls/data.sqlite
firefox 6972 andrew  115uw     REG              253,2     65536  133582 /home/andrew/.mozilla/firefox/qe5rlihv.default/protections.sqlite
firefox 6972 andrew  118uw     REG              253,2    262144 2499866 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage/default/https+++www.google.com/ls/data.sqlite
firefox 6972 andrew  119rr     REG              253,2  23166976  132221 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite
firefox 6972 andrew  124ur     REG              253,2     32768  137685 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage-sync-v2.sqlite
firefox 6972 andrew  125u      REG              253,2  13444752  147466 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage-sync-v2.sqlite-wal
firefox 6972 andrew  126ur     REG              253,2     32768  147474 /home/andrew/.mozilla/firefox/qe5rlihv.default/storage-sync-v2.sqlite-shm
firefox 6972 andrew  127u      REG              253,2  37153368  132284 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite-wal
firefox 6972 andrew  128ur     REG              253,2  23166976  132221 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite
firefox 6972 andrew  129u      REG              253,2  37153368  132284 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite-wal
firefox 6972 andrew  130ur     REG              253,2     32768  132316 /home/andrew/.cache/mozilla/firefox/qe5rlihv.default/suggest.sqlite-shm
firefox 6972 andrew  133rw     REG              253,2  36700160  131305 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite
firefox 6972 andrew  135u      REG              253,2   2393848  137142 /home/andrew/.mozilla/firefox/qe5rlihv.default/places.sqlite-wal
firefox 6972 andrew  136rw     REG              253,2  43876352  135062 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite
firefox 6972 andrew  137u      REG              253,2    327952  137444 /home/andrew/.mozilla/firefox/qe5rlihv.default/favicons.sqlite-wal

which didn’t narrow things down. But amazingly, immediately after running this command, it stopped whatever CPU hogging it was doing.

I don’t have any theories on why lsof would do this but was happy it did. If it was something about a deadlock, something something accessing the info on the file caused the deadlock to be broken. Not sure.