# Firefox  "STOPS" and hangs



## JayArr (Sep 10, 2019)

Hi All

I've got this bug whereby Firefox just freezes sometimes. I can go for days without a problem then have it freeze up two or three times in one day. When it freezes I can switch to a terminal running top and see that one of the 4-5 processes called Firefox is in a state of STOP. I can kill the other Firefox processes but I cannot kill the one in the STOP state. If I just walk away the last process will eventually terminate itself but it can take as much as five minutes. I need to find a way to kill this off faster so I can restart Firefox and continue working.

I've reloaded Firefox and upgraded it twice, I've also made sure my system is all up to date but the bug continues. I'm past trying to stop it, now I just want to minimize it's effect by finding a way to kill and restart as quickly as possible.

If I kill all the other Firefox processes I can sometimes restart Firefox and it will tell me bookmarks are unavailable. That gives a bit of a clue that it may be tied to the sqlite that accesses the bookmarks database but I'm not 100% sure.

I'm looking for suggestions on tools, commands etc that will help me trace from the "STOP"ed process to whatever it's waiting for, is there some way to find what it is associated with or connected to a process listed in top?


----------



## PMc (Sep 11, 2019)

Just guessing: it might be related to one of the many subsystems and libraries firefox relies on.
So, if You build it from source, I would try to disable as much of the options as possible - and see if that makes the error go away. Otherwise, if installing package, this should be used by many people, so others would run into the error also - so, probably something is different on Your system. You might check `pkg info -d firefox` and see if any of these packages might need an upgrade.

Then, killing: if you use `kill -9` and it doesn't go away, there is not much more one can do.

Ups - just found this one here: http://freebsd.1045724.x6.nabble.com/Processes-stuck-in-STOP-state-on-12-0-BETA3-td6293519.html
You might search if there is more to the matter.


----------



## JayArr (Sep 11, 2019)

Thanks PMc

It's installed from packages and like I said, everythings up to date. I am using xfce but that shouldn't be the cause. At any rate, I'm through with chasing why it stops and looking pragmatically at how I can quickly just kill it all off and start over.

Thanks for the link, I'll check out the procstat command to see what comes up next time it stops.


----------



## PMc (Sep 11, 2019)

JayArr said:


> It's installed from packages and like I said, everythings up to date. I am using xfce but that shouldn't be the cause. At any rate, I'm through with chasing why it stops and looking pragmatically at how I can quickly just kill it all off and start over.



Doesn't look like that would work. But as there was somebody with quite precisely the same problem description as You (albeit on a BETA version), I think this is the really interesting information: it's not specific to You.


> Thanks for the link, I'll check out the procstat command to see what comes up next time it stops.



That was Konstantin asking that user - but then there was no more reply.  Otherwise that thing might probably have been hunted down in BETA.
Not sure if You or me get much clue from that `procstat -k`. :/

But what You actually could do is followup on that message in that mailing-list. You could also deliberately search the web if there are more similar reports - where there are two, there may be more.

BTW, You didn't mention which OS version You use?


----------



## JayArr (Sep 11, 2019)

Sometimes the fact that there is no further reply is an indication that the OP found a solution and wasn't polite enough to return and share. (Not always but sometimes) so I don't mind chasing down the rabbit hole a little.

I've searched quite a bit, I've probably spent close to four hours looking for a solution but all I get is advice to make sure everything is up to date and using the latest versions. This is normally good advice but I've done that and been 100% up to date and the bug still exists so that's not the solution. A lifetimes experience tells me that sometime in the near future the bug will just disappear as versions progress and the conflict is eventually removed, what I need is a solution until then. For now I'm keeping Chromium installed and open, when Firefox freezes I can continue to work with Chromium but it's really slow compared to Firefox and "not quite ready for prime time" for eg, I can't print just the frame, I have to print the whole page, that just won't work with my finance software.

I'm running 11.2 with Firefox 68


----------



## T-Daemon (Sep 11, 2019)

JayArr said:


> I'm running 11.2 with Firefox 68


Unless it's a typo, www/firefox is available in FreeBSD:11:amd64/quarterly in version firefox-69.0_1,1 , in FreeBSD:11:amd64/latest and ports in version firefox-69.0_2,1.

Please upgrade.


----------



## PMc (Sep 11, 2019)

JayArr said:


> A lifetimes experience tells me that sometime in the near future the bug will just disappear as versions progress and the conflict is eventually removed,



Yes, thats quite true with firefox. My solution then was to go with firefox-esr - which seems to save me a bunch of troubles.


----------



## JayArr (Sep 11, 2019)

OK, I upgraded Firefox to 69 as T-Daemon suggested and now I've lost the ability to print just the frame of a page. Since this is vital to my finance software I need to roll back to 68. Any hints on how to do that?


----------



## JayArr (Sep 11, 2019)

I just looked at Firefox-ESR and I wouldn't mind paying but there is no mention of FreeBSD, are you using the Linux version?


----------



## T-Daemon (Sep 11, 2019)

www/firefox-esr


----------



## JayArr (Sep 11, 2019)

UPDATE: I found the frame print command for Firefox 69, it's no longer in any of my print dialogs but it does exist if you right click in the frame and then go `This Frame` then `Print Frame`


----------



## PMc (Sep 11, 2019)

JayArr said:


> I just looked at Firefox-ESR and I wouldn't mind paying but there is no mention of FreeBSD, are you using the Linux version?



No, it builds from ports, and is certainly also available as FreeBSD package.


----------



## JayArr (Sep 11, 2019)

OK, I see it now as an available package, I was looking on the website before and couldn't find a FreeBSD version.

Now that I've updated to FF69 I'm going to wait a day or so, if it still freezes and goes into a stop state I'll pull FF69 and try ESR.


----------



## JayArr (Sep 11, 2019)

Well, that lasted about 6 hours LOL, it just froze up as usual so the upgrade I did this morning was a waste of 15 minutes.

I'll pull firefox69 tonight and try ESR

Here is the result of `procstat -k` on the STOPed process



> $ procstat -k 33970
> PID    TID COMM                TDNAME              KSTACK
> 33970 100201 firefox             -                   mi_switch thread_suspend_check ast doreti_ast
> 33970 100443 firefox             StreamTrans #103    mi_switch thread_suspend_check ast doreti_ast
> ...



It looks like this thread is the problem:



> 33970 100470 firefox Compositor mi_switch sleepq_wait _sleep bwait bufwrite softdep_process_journal softdep_sync_buf ffs_syncvnode ffs_truncate ffs_write VOP_WRITE_APV vn_io_fault_doio vn_io_fault1 vn_rdwr vn_rdwr_inchunks elf64_coredump sigexit postsig



"coredump sigexit postsig"?

Is this what I'm waiting for?

Is there some way to instruct FF not to do a core dump?


----------



## oops (Sep 12, 2019)

JayArr said:


> Is there some way to instruct FF not to do a core dump?


`sysctl kern.coredump=0` for every process or `limits -c0 firefox` for new process or `pgrep firefox | xargs -n1 limits -c0 -P` for existing process.


----------



## JayArr (Sep 12, 2019)

OK, I ran `sysctl kern.coredump=0`

I also ran `echo 'kern.coredump=0' >> /etc/sysctl.conf` so it comes into play in future boots.

Let's see if that helps. If it at least causes Firefox to just crash and exit without the five minute delay that would be an acceptable interim solution.


----------



## JayArr (Sep 13, 2019)

Hey, since I put those core dump commands in it hasn't frozen up once!


----------



## JayArr (Sep 18, 2019)

UPDATE: It has crashed a couple of times but when that happens it doesn't freeze up. My conclusion is that it was the coredump that was causing it to appear like it was hung up or frozen. Now that core dumps aren't allowed the crash simply ends the processes and I can immediately restart Firefox.


----------



## eternal_noob (Aug 29, 2021)

I have the same problem with `firefox-esr` running on Raspberry Pi 400 / FreeBSD 13.0-RELEASE.

Checking out if


JayArr said:


> sysctl kern.coredump=0


helps with the unkillable firefox process.


----------



## grahamperrin@ (Aug 30, 2021)

eternal_noob said:


> … if `sysctl kern.coredump=0` helps with the unkillable firefox process. …



I doubt it. 

`freebsd-version -kru`

Also, is a hang reproducible with Firefox in safe mode?


----------



## eternal_noob (Aug 30, 2021)

grahamperrin said:


> I doubt it.


Well, seems like it works. Firefox crashed again but this time i was able to kill and restart it.


```
[xxx@xxx ~]$ freebsd-version -kru
13.0-RELEASE-p4
13.0-RELEASE-p4
13.0-RELEASE-p4
```



grahamperrin said:


> safe mode?


Safe mode? How?


----------



## grahamperrin@ (Aug 30, 2021)

eternal_noob said:


> Safe mode? How?




Help menu
Troubleshoot Mode…
With ESR the menu option might still be _Safe Mode…_ I can't recall when/whether the wording changed.


----------



## bsduck (Aug 30, 2021)

Also available from the command line: `firefox --safe-mode`


----------

