On Sat, Apr 19, 2025 at 14:47 (+0200), deloptes via tde-users wrote:
Darrell Anderson via tde-users wrote:
I looked into that and confirmed Firefox takes about 10 to 12 seconds to fully terminate. On a 4-core system with an nvme disk.
It sounds great, that you narrowed down the issue. Firefox is writing a lot of things to disk and/or internal database, so that you can restore the session the next time you start. I usually never close it before exit because on next start/login it is spawned automatically by TDE and it asks me to restore the previous session or it just restores all windows automatically. It is a beast that takes it's time. My bet is that it takes 10-12sec to write to the internal sqlite database. You can use strace -fp <firefox pid> to see what it is doing (of course you must login on the console outside TDE :-)
I'm not sure what you guys have going on, my firefox (with 40 or 50 open tabs) takes a second or three to shut down.
I just timed it as follows, after using ps to determine that the main firefox process' PID was 24402:
date +%s.%N ; kill -TERM 24402; while ls /proc/24402 > /dev/null 2>&1 ; do ; date +%s.%N ; done
The output was 1745073214.695149607 1745073214.704957548 1745073214.710325927 1745073214.721915419 1745073214.730364874 1745073214.740190648 1745073214.749773235 1745073214.756865326 1745073214.763335939 1745073214.774071905 1745073214.789571122 1745073214.801696883 1745073214.859510512 which I interpret as meaning that firefox took about 0.164360905 seconds to shut down on my computer. (This was shortly after starting it up, I tried another way of timing it after it had been running for days, and in that case it took about 2 second to shut down.)
So what's different between my system and yours? I can think of two possible things.
(1) While I use some TDE programs, I don't use TDE as my desktop environment (I use fvwm3 as my window manager), so maybe there is some long-winded interaction going on between firefox and TDE as firefox shuts down.
(2) I also don't have firefox store my session (and other info) in the "cloud", so that is another possibility of what is taking long. Perhaps one of you with long shutdown times could do an ifconfig -a before starting the shutdown and another ifconfig -a after, to see how much network activity happened. (Of course, shut down anything else likely using much network bandwidth before shutting down firefox.)
Other than that, I don't know. FWIW, my laptop is reasonably fast but not a killer machine (Ryzen 4700U CPU with a NVME "disk"). Running while date +%s.%N ; do ; done from a terminal window shows that loop takes about 0.0047 seconds per iteration, using while date +%s.%N ; do ; done | head -1001 and then dividing the difference between the first and last outputs by 1000. Your mileage will no doubt vary. To avoid scrolling back, try this: while date +%s.%N ; do ; done | (read l ; echo $l ; head -1000 | tail -1) and then do the arithmetic.
Jim