spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 2:47 am

Just wondering if it's just me, but my Pi4 (4GB) experiences frequent "hangs" while using the Chromium browser. I am typing this comment from Firefox, because it has gotten so bad that I can't use Chromium any more.

I am so embedded in the Chrome/google ecosystem that this causes me a lot of stress. Is there any way to fix this?

Basically, when Chromium is running, whether I am actively working in the browser window or even elsewhere in the desktop, I get periods of about 5 seconds where I can't click anything, type anything, etc...

I am not experiencing this in Firefox.

Any thoughts?

RossDv8
Posts: 244
Joined: Thu Jan 21, 2016 12:35 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 3:58 am

Yes !
I had exactly the same problem. It is mentioned on another topic.
I tried swapping my Sandisk Ultra microSD for a brand new Samsung EVO Plus card in case my old card was corrupt. It did nothing.

But, I put in a little spare Sandisk card. Plugged in an SSD with Buster on it to a USB 3 port, and followed the instructions to boot from the microSD and run Buster on the SSD.

That cured all the Chromium problems and fixed a lot of other little niggles too.
If you don;t have access to an SSD, but do have access an external USB 3 HDD, it might be worth trying out.
Remember, nobody is listening to you
until you fart ...

mattmiller
Posts: 2230
Joined: Thu Feb 05, 2015 11:25 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 7:40 am

I'm not an expert in this area but pauses in GUI desktop use on computers are usually caused by something else taking some time

One of the most common reasons is that the OS has run out of RAM and is swapping stuff out from RAM to external storage etc

This would explain the OP issue and might explain why shifting to faster external storage would seem to cure the second one

I'd check to see if your coming close to using all your RAM up

renice123
Posts: 180
Joined: Tue Oct 15, 2019 3:56 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 1:36 pm

The problem with freezing Chromium is to some extent related to the OS settings. For several months now I have been using only Raspberries as my main computer (to be honest, I use two Raspberries). I am an active Internet user, I watch films for a long time, listen to music and do almost everything I did on a “regular” computer. Therefore, I first of all got rid of the “freezing” of Chromium. In fact, it is very easy and you do not even need to install an external SSD (although this is a good idea). Chromium "freezes" due to the fact that it constantly writes to the sd card, which causes the illusion of stopping. I just transferred the whole /home/pi directory to virtual memory (fstab> tmpfs). After that, I never saw Chromium “freeze”, and also Chromium does not write its garbage to my card.
PS Chromium also has an unpleasant problem of computer “freezing” during frequent viewing of video. I still don’t know how to solve this problem, I suspect that there are some imperfections with video drivers, but I can’t check it yet. In this case, Chromium simply shuts down the entire operating system and you need to physically disconnect the power source.
But besides Chromium there are several more browsers that you can use.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 26413
Joined: Sat Jul 30, 2011 7:41 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 2:33 pm

Interesting, not seen it on Pi, but I do get occasional pauses of about 10s on my x86 laptop (I7, 16GB RAM) when using Chrome. So I don't think it's limited to the Pi, or even the ARM architecture.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed.
I've been saying "Mucho" to my Spanish friend a lot more lately. It means a lot to him.

Ernst
Posts: 1331
Joined: Sat Feb 04, 2017 9:39 am
Location: Germany

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 3:24 pm

jamesh wrote:
Tue Nov 26, 2019 2:33 pm
Interesting, not seen it on Pi, but I do get occasional pauses of about 10s on my x86 laptop (I7, 16GB RAM) when using Chrome. So I don't think it's limited to the Pi, or even the ARM architecture.
Lately I see this occasionally on my Samsung TAB S4.
The road to insanity is paved with static ip addresses

RossDv8
Posts: 244
Joined: Thu Jan 21, 2016 12:35 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Tue Nov 26, 2019 9:42 pm

PS Chromium also has an unpleasant problem of computer “freezing” during frequent viewing of video. I still don’t know how to solve this problem,
If you mean freezing playing video from a site like YouTube, I was getting frustrated by Chromium either freezing, or continually buffering.
gkreidl solved it for me, by posting on this forum, a method to view video from some sites (some hundreds of sites actually) by using the system kweb Minimal Kiosk Browser used on the early Pis with little RAM available.

He set up a method for adding a bookmark to Chromium that enables it to use youtube-dl to extract a video from the current page then open a VLC standalone window, and play the video.
Now, as has been pointed out to me in another discussion, youtube-dl extracts at 720p. However, on a 4k Youtube video, VLC is giving me a clearer, sharper video, with no buffering at 720p (according to VLC codec info) on the Pi 4, than I can get on a dedicated 4k streaming player alongside it.

I'm not trying to 'sell' anything here. Just suggesting that there's a quite easy and effective way to get very good streaming video performance from Chromium.
The alternative, which is particularly good on the 'testing' VLC package for raspbian, is to open VLC, do CTRL+n copy the link from Chromium and paste it into VLC.
Remember, nobody is listening to you
until you fart ...

spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Wed Nov 27, 2019 1:04 am

RossDv8 wrote:
Tue Nov 26, 2019 3:58 am
Yes !
I had exactly the same problem. It is mentioned on another topic.
I tried swapping my Sandisk Ultra microSD for a brand new Samsung EVO Plus card in case my old card was corrupt. It did nothing.

But, I put in a little spare Sandisk card. Plugged in an SSD with Buster on it to a USB 3 port, and followed the instructions to boot from the microSD and run Buster on the SSD.

That cured all the Chromium problems and fixed a lot of other little niggles too.
If you don;t have access to an SSD, but do have access an external USB 3 HDD, it might be worth trying out.
I might give that a try. I think i have an old SSD laying around somewhere.

spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Wed Nov 27, 2019 1:06 am

renice123 wrote:
Tue Nov 26, 2019 1:36 pm
The problem with freezing Chromium is to some extent related to the OS settings. For several months now I have been using only Raspberries as my main computer (to be honest, I use two Raspberries). I am an active Internet user, I watch films for a long time, listen to music and do almost everything I did on a “regular” computer. Therefore, I first of all got rid of the “freezing” of Chromium. In fact, it is very easy and you do not even need to install an external SSD (although this is a good idea). Chromium "freezes" due to the fact that it constantly writes to the sd card, which causes the illusion of stopping. I just transferred the whole /home/pi directory to virtual memory (fstab> tmpfs). After that, I never saw Chromium “freeze”, and also Chromium does not write its garbage to my card.
PS Chromium also has an unpleasant problem of computer “freezing” during frequent viewing of video. I still don’t know how to solve this problem, I suspect that there are some imperfections with video drivers, but I can’t check it yet. In this case, Chromium simply shuts down the entire operating system and you need to physically disconnect the power source.
But besides Chromium there are several more browsers that you can use.
Maybe I am getting my terminology wrong, but isn't virtual memory a physical disk (or in this case the SD card)?

Did you mean a RAMdisk? Do you have any tips on how to do this? I am willing to give this a try.

spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Wed Nov 27, 2019 1:08 am

mattmiller wrote:
Tue Nov 26, 2019 7:40 am
I'm not an expert in this area but pauses in GUI desktop use on computers are usually caused by something else taking some time

One of the most common reasons is that the OS has run out of RAM and is swapping stuff out from RAM to external storage etc

This would explain the OP issue and might explain why shifting to faster external storage would seem to cure the second one

I'd check to see if your coming close to using all your RAM up
It doesn't appear that my RAM is coming close to being full. htop shows about 1.74GB in use (of 3.81GB) with firefox and chromium open (about 3 tabs each).

RossDv8
Posts: 244
Joined: Thu Jan 21, 2016 12:35 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Wed Nov 27, 2019 3:24 am

I deleted Firefox because it was crashing a lot. Like the 'Aww Snap' message in Chromium, but it says something else.
I fixed the problem in Chromium, but could not solve it in firefox, even trying things other people did.
However, here's my memory usage with Chromium (3 tabs) and Epiphany (3 tabs) just for comparison:

Code: Select all

pi@raspberrypi:~ $ free -h
              total        used        free      shared  buff/cache   available
Mem:          3.5Gi       912Mi       1.7Gi       320Mi       973Mi       2.3Gi
Swap:         2.0Gi          0B       2.0Gi
pi@raspberrypi:~ $ 
Remember, nobody is listening to you
until you fart ...

renice123
Posts: 180
Joined: Tue Oct 15, 2019 3:56 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Wed Nov 27, 2019 7:46 am

Sorry, I don't speak English well. Yes, I'm talking about creating a disk in RAM. As far as I know (I'm an old Linux user), Chromium contains critical errors by inheritance. Firefox also borrows many errors: these browsers have a lot in common. There are, for example, browsers such as Luakit, which do not cause disasters when working with the operating system.

Alas, there are no worthy alternatives, as these browsers have captured the market and monopolists.
I tried to limit the appetite of Chromium through ulimit, this does not help. Chromium is just a poorly written program and you have to put up with it.

The most unpleasant critical error of Chromium is the failure of the whole system to work if Chromium freezes at some point. This failure cannot be isolated due to an error in the kernel video driver (as far as I understand the problem)

Failure is easy to cause if you go to sites where there is a lot of flash, video and javascript (usually these are video sites with many windows of movie previews). Chromium freezes at some point, and the entire operating system freezes with it. Watchdog does not help. Only physical power off helps. The failure of the operating system almost always occurs after about an hour of viewing such sites (when you leaf through pages with a preview).

The same problem was at Jessie in Raspberry, I conclude that this is a hereditary disease associated with the architecture of arm and poorly written program Chromium.

I found a solution with zram and electronic disks in the memory on a diskless client forum. The essence can be described in the following words.

1. Install the zram program (here on the forum there is a thread dedicated to this program).
Zram can really fix some of Debian's problem areas.

2. Then create the necessary entries in fstab (for user pi).
Transfer the entire / home / pi directory to RAM, mount it as tmpfs. To save some important settings (for example, passwords and site logins), you can write a boot script that will write data to /home/pi/.config at boot time. This is convenient if you want to use Chromium and automatically save cookies and other settings.
It will also allow you to configure the system once, write all the data to a directory on the memory card and automatically copy the data to home / pi / when loading
It will also extend the life of your memory card, as browsers are programs that kill the memory card with uninterrupted recording garbage.

3. Optimize fstab, specify such parameters as noatime, nodiratime, errors = remount-ro and others.
The journaled file system does not work well with memory cards, since it also writes data to the memory card almost every second of its own. File system can be optimized
It is better to transfer these directories to memory.
tmpfs / var / log tmpfs nosuid, nodev 0 0
tmpfs / var / tmp tmpfs nosuid, nodev 0 0

4. Many programs write their unnecessary logs to disk. Disable logging of these programs or create links to recording directories in tmp
#rm -rf / var / lib / dhcp / var / lib / dhcpcd5 / var / spool
ln -s / tmp / var / lib / dhcp
ln -s / tmp / var / lib / dhcpcd5
ln -s / tmp / var / spool

Add to this the following

rm -rf / var / cache / fontconfig
ln -s / tmp / var / cache / fontconfig

Do you need fontconfig cache? Are you sure you know why you need / var / lib / dhcpcd5? This seems to be trash that you most likely will never need. Make a symbolic link.

There are many sites that describe even more advanced ways to speed up the operating system, including by optimizing the work with the file system and disabling the garbage output of programs, I write about the methods that I use.
If the cache is organized in RAM, Chromium is very fast. For several months now I have been using only Raspberry microcomputers at home and have almost no discomfort. Except for the tragic hang of Raspberries due to poorly written Chromium.

PS The Debian forums are abusively abusing Chromium. Large RAM does not help Chromium; Chromium simply hangs the system due to critical errors in any case.

spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Sun Dec 01, 2019 1:00 am

Quick update

I configured my Pi4 to use an SSD as the root drive and this improved things significantly. Using a cheap PNY CS900 120GB SSD and a StarTech USB3-to-2.5" SATA adapter.

My only complaint is that the adapter I am using doesn't have an LED activity indicator. It is nice to see the access indicator running (as it did on a different adapter). Unfortunately, the other adapter with the LED didn't play nice with the pi4's USB3 ports due to a chipset limitation.

I used this guide (with minor adjustments) to make it work (excellent resource!):
https://jamesachambers.com/raspberry-pi ... sh-drives/

EDIT: corrected model number of PNY SSD to CS900 (not CS300).

RossDv8
Posts: 244
Joined: Thu Jan 21, 2016 12:35 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Sun Dec 01, 2019 4:16 am

My only complaint is that the adapter I am using doesn't have an LED activity indicator. It is nice to see the access indicator running (as it did on a different adapter). Unfortunately, the other adapter with the LED didn't play nice with the pi4's USB3 ports due to a chipset limitation.
I am in Australia, so this link might not be any use to you other than to show an actual adapter that 'WORKS'.
So if you are searching for an adapter, perhaps look for one that looks exactly like this one.
USB-3-SATA.jpg
USB-3-SATA.jpg (114.8 KiB) Viewed 1828 times
The two little dots near where it says SATA are a Red LED for Power and a Blue LED for Activity.

http://www.ebay.com.au/itm/USB3-0-to-SA ... 443f9f80a7

It works great with the Pi 3B+ and Pi 4, especially with SSD.
These do show up in searches in other countries, and of course, China. But in my country they are pretty expensive. AUD $10 - $12 (Free Postage). I'm about to buy one or two more.

It's worth the price to know it works. And to have the power and activity lights. :D
Remember, nobody is listening to you
until you fart ...

spiff72
Posts: 44
Joined: Sun Mar 31, 2019 5:48 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Sun Dec 01, 2019 5:25 am

RossDv8 wrote:
Sun Dec 01, 2019 4:16 am
My only complaint is that the adapter I am using doesn't have an LED activity indicator. It is nice to see the access indicator running (as it did on a different adapter). Unfortunately, the other adapter with the LED didn't play nice with the pi4's USB3 ports due to a chipset limitation.
I am in Australia, so this link might not be any use to you other than to show an actual adapter that 'WORKS'.
So if you are searching for an adapter, perhaps look for one that looks exactly like this one.
USB-3-SATA.jpg

The two little dots near where it says SATA are a Red LED for Power and a Blue LED for Activity.

http://www.ebay.com.au/itm/USB3-0-to-SA ... 443f9f80a7

It works great with the Pi 3B+ and Pi 4, especially with SSD.
These do show up in searches in other countries, and of course, China. But in my country they are pretty expensive. AUD $10 - $12 (Free Postage). I'm about to buy one or two more.

It's worth the price to know it works. And to have the power and activity lights. :D
Ha - that looks like one that I could have purchased, but it would have taken a couple of extra days! :D Live and learn I guess... The one I linked to below is listed on the site I posted above as a known-working adapter. It would have been cheaper to boot, but I wanted to get it sorted out quickly rather than waiting.

https://www.amazon.com/ELUTENG-Adapter- ... uage=en_US

RossDv8
Posts: 244
Joined: Thu Jan 21, 2016 12:35 pm

Re: Pi4: Chromium Browser Causes frequent hangs (5 seconds or so duration)

Sun Dec 01, 2019 5:54 am

Damn. That ELUTENG one is exactly the same as the one I have. And I just bought another one from ebay (local) for just over $10 incl post. It was a bit under AUD $8 delivered if I wanted to wait a few weeks for shipping form China.

One of these days I will remember we have Amazon in Australia. Difficult when I've been buying from ebay since about 2000...

E D I T
I don;t feel so bad now.
Amazon Australia has it just a tad more expensive (AUD$15.81+ $7.64 Delivery)
than the US $7.99 price.
In Aus that is more than twice the price of the ebay one incl delivery So it might be worth checking your ebay for one in your country.
Remember, nobody is listening to you
until you fart ...

Return to “Troubleshooting”