Firefox seems broken after suspend

I have my PC set to sleep (i.e. suspend) after a couple hours of inactivity. This works as expected—except for Firefox. Recently, it seems every time I wake the PC from suspend, Firefox is in a “bad state”: there are many pages that simply won’t load. The most common case is I click on a link to go to a new page, and the current page will clear, and the next page will either not load at all (i.e. nothing but a blank screen), or only a very small portion of the page will load.

It is resolved if I kill Firefox and restart it. But this is very annoying, since I deliberately keep over a dozen tabs open.

I thought maybe this was some bug, but it has persisted for several weeks now, across multiple Firefox version upgrades (currently on version 79.0).

The other thing that may be relevant - I recently changed my home directory to be on an auto-mounted NFS share (rather than on the local disk of the PC). I don’t recall if this errant Firefox behavior started at the exact time as making this home directory change or not.

Thank you for any help or advice!

Hi. I’d bet money that it’s to do with the display manager. Check the system logs (systemd/Journal - ArchWiki) and report back on what they say.
Also, what is your display manager? Kwin, x11, Wayland?

You also can look if it’s related to memory management.

  • If you’re using a lot of tabs as I do, this setting can help : about:config and set browser.tabs.unloadOnLowMemory to true
  • Both for memory and safety management, I use Site Bleacher
  • swap management is also important, give us :
cat /proc/sys/vm/swappiness
cat /proc/sys/vm/vfs_cache_pressure
swapon -s

I don’t see any obvious errors in the system log… got any tips on something specific I should be looking for? Posting the entire log, even if constrained to the most recent wake-from-sleep is several screens long.

I feel like if it was an X or KDE Plasma issue, then I would have problems with other applications, and/or the UI in general. But all other apps work as expected, it’s only Firefox that has problems. And even then, not all pages in Firefox have issues, just some.

Here’s my system details:

# inxi -Fxxxz
  Kernel: 5.4.57-1-MANJARO x86_64 bits: 64 compiler: gcc v: 10.1.0 Console: tty 6 
  DM: SDDM Distro: Manjaro Linux 
  Type: Desktop Mobo: ASRock model: B450 Gaming-ITX/ac serial: <filter> 
  UEFI: American Megatrends v: P3.40 date: 07/17/2019 
  Topology: Quad Core model: AMD Ryzen 5 2400G with Radeon Vega Graphics bits: 64 
  type: MT MCP arch: Zen L1 cache: 384 KiB L2 cache: 2048 KiB L3 cache: 4096 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm 
  bogomips: 57519 
  Speed: 1813 MHz min/max: 1600/3600 MHz boost: enabled volts: 1.5 V 
  ext-clock: 100 MHz Core speeds (MHz): 1: 1813 2: 1543 3: 1540 4: 1393 5: 1871 
  6: 1567 7: 1416 8: 1462 
  Device-1: AMD Raven Ridge [Radeon Vega Series / Radeon Vega Mobile Series] 
  driver: amdgpu v: kernel bus ID: 0a:00.0 chip ID: 1002:15dd 
  Display: server: 1.20.8 compositor: kwin_x11 driver: amdgpu FAILED: ati 
  unloaded: modesetting alternate: fbdev,vesa tty: 90x69 
  Message: Advanced graphics data unavailable in console for root. 
  Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio driver: snd_hda_intel v: kernel 
  bus ID: 0a:00.1 chip ID: 1002:15de 
  Sound Server: ALSA v: k5.4.57-1-MANJARO 
  Device-1: Intel Dual Band Wireless-AC 3168NGW [Stone Peak] driver: iwlwifi v: kernel 
  bus ID: 07:00.0 chip ID: 8086:24fb 
  IF: wlp7s0 state: down mac: <filter> 
  Device-2: Intel I211 Gigabit Network vendor: ASRock driver: igb v: 5.6.0-k 
  port: f000 bus ID: 08:00.0 chip ID: 8086:1539 
  IF: enp8s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
  IF-ID-1: virbr0 state: down mac: <filter> 
  IF-ID-2: virbr0-nic state: down mac: <filter> 
  Local Storage: total: 465.76 GiB used: 135.75 GiB (29.1%) 
  ID-1: /dev/nvme0n1 vendor: Samsung model: SSD 960 EVO 500GB size: 465.76 GiB 
  speed: 31.6 Gb/s lanes: 4 serial: <filter> rev: 3B7QCXE7 scheme: GPT 
  ID-1: / size: 442.34 GiB used: 135.75 GiB (30.7%) fs: ext4 dev: /dev/nvme0n1p2 
  ID-1: swap-1 type: partition size: 15.05 GiB used: 0 KiB (0.0%) priority: -2 
  dev: /dev/nvme0n1p3 
  System Temperatures: cpu: 39.6 C mobo: N/A gpu: amdgpu temp: 39 C 
  Fan Speeds (RPM): fan-1: 827 fan-2: 510 fan-3: 0 fan-4: 0 fan-5: 0 
  Processes: 302 Uptime: 6d 16h 25m Memory: 13.60 GiB used: 6.01 GiB (44.2%) 
  Init: systemd v: 245 Compilers: gcc: 10.1.0 clang: 10.0.1 Packages: pacman: 1785 
  Shell: Bash v: 5.0.18 running in: tty 6 inxi: 3.1.05 

I changed the Firefox setting, I’ll have to wait and see if it makes a difference. If not, I’ll give Site Bleacher a try.

This system has 16 GB of RAM. While I did set up space for swap, it should never be used, as I’m not doing anything terribly memory intensive:

# cat /proc/sys/vm/swappiness 

# cat /proc/sys/vm/vfs_cache_pressure 

# swapon -s
Filename                                Type            Size    Used    Priority
/dev/nvme0n1p3                          partition       15784476        0       -2

# free -h
              total        used        free      shared  buff/cache   available
Mem:           13Gi       5.8Gi       2.2Gi       588Mi       5.6Gi       6.9Gi
Swap:          15Gi          0B        15Gi


I rather use systemd-swap, but @ this stage it won’t be a major change.

Let’s optimize RAM use :

echo vm.swappiness=5 | sudo tee -a /etc/sysctl.d/99-sysctl.conf
echo vm.vfs_cache_pressure=50 | sudo tee -a /etc/sysctl.d/99-sysctl.conf
sudo sysctl -p /etc/sysctl.d/99-sysctl.conf

Also, tell us you add-ons :

grep -oP '},"name":"\K[^"]+' ~/.mozilla/firefox/*.*default*/addons.json

I’m posting from my phone so spitballing mostly: the logs can be grepped for x11 instances. Also, see Firefox - ArchWiki

I updated the settings per your instructions. I went ahead and did a reboot, as I had a number of packages (including the kernel) that were updated.

Only one add-on, uBlock Origin:

$ grep -oP '},"name":"\K[^"]+' ~/.mozilla/firefox/*.*default*/addons.json
uBlock Origin

I don’t see any x11 errors in the logs, either.

Whatever issue this is, it’s also affecting the Manjaro forums: this is my second time posting, the first time, after I typed out this reply, I hit the “reply” button, and it looked like it was replying (the edit box went away, and the red bar at the bottom popped up), but just hung for several minutes, until I gave up and restarted Firefox.

Did you restart ? Do you still have these freezes ?

Yes, I restarted, and unfortunately, yes, I still have the issue.

My suspicion still lies with it being a combination of the computer going to sleep and my home directory being an NFS share. More specifically, my home directory is an auto-mounted NFS share. I have an entry like this in /etc/fstab:

nfs-server:/home/dir/share   /home/myhome   nfs   noauto,x-systemd.automount,x-systemd.device-timeout=10,timeo=14,hard,intr 0 0

I don’t know all the low-level details of suspend and nfs automount, but it’s easy to conceive of a sequence issue where, when the suspend sequence starts, Firefox wants to write something but the NFS share is already unmounted. That’s just a guess, but it’s easy to test - I’ll just make the NFS share a static mount, rather than automount.

Having no notion of NFS share, I remotely graps this ! :wink: