[SFOS Browser] Solving the browser memory issue

Same effect here on a Sony XA2 Plus; a lot less crashes after removing the ‘f’.

Please @Jolla, can you publish a minor release for this fix (and maybe even some more improvements)

funny, floating point math. the theme of the week for me. I’ll test this, though frankly, I’ve just moved on to using angelfish which never crashes AND supports WASM, etc. I’ll try a structured report form now.

Visual Studio Code March 2023 10 clicks.
https://spiegel.de just navigate all the cookie related pages. they don’t have any news anyway.

  1. https://diezeit.de it was a nice newspaper until about 1999, same a spiegel. didn’t crash about 3 pages
  2. https://amazon.de steamdeck 1000 euros. no way. ah, 419 direct. It’s more fun in Vietnam. 8 product pages.
  3. Steam Deck causes the fan on my laptop to go, go, go… caused the browser into the background. steamdeck site was visible on the cover. focus, and repeat back to cover. It’s the full backgournd animation. Playing a couple of videos on the steam store also, ooooommmmph.

Ok. that went quick. Still, seems more stable.

steamdeck.com on angelfish crashes almost as quickly. soo it’s not the browser, it’s the web meets memory limited system I guess.

2 Likes

Just for info, in case it interests: I tested both Stock Browser and Angelfish with this site:
http://websdr.ewi.utwente.nl:8901/
(this is a shortwave web-SDR operated by the University of Twente / Netherlands)

Result is:
Sailfish Browser: works perfect, no problems.
Angelfish: Homepage works but sound stutters, browser - edit: only a little bit - too slow.

Do we have any profiling tools for Browser? Can it log its memory usage stats into a file? Is there some rpc mechanism to pull stats?

1 Like

For me this fix is amazing, removing the f made my XA2 much speedier and the browser is really more snappy. This should definitely be in the next release.

3 Likes

Setting general.smooth.scroll to off did also make things better. I guess, the smoothing effects unnecessarily eat memory + CPU capacity for little benefit. So I disabled it and get better results now.

edit: This is a list of about:config settings:
https://kb.mozillazine.org/About:config_entries

2 Likes

Ah, neat. I noticed that scroll for most (not all) crashes they appeared to be triggered by scroll. I wonder if I’m just imagining it or if we get enough confirmation we should build a proper bug report with reproducible pages / behaviours.

3 Likes

I think it’s worth a bug report. It was often reported (and tortured me for a long time :wink: ). I’m really curious what the real underlying problem is.
To my previous post I want to add, that there are more settings in about:config, that begin with general.smoothScroll.* and contain some details for what it’s valid. I did set to off all of them.

First, thanks to get this problem solved. It occurs me too. But how to remove the -f ? Little instruction, please?

Open Stock Browser,
enter ‘about:config’ into the browsers address line (without the two ’ )
confirm that you know what you are doing
Then appears a page with abt. 1000 settings, they are sorted alphabetically.

Scroll down to the mentioned field.

Tap into the content field of ‘apz.touch_start_tolerance’ where the f is, set cursor right from the f
Tap backspace once to remove the f
You can also change the number to ‘0.1’
Tap ‘accept’ in the upper right corner of the screen.
Enjoy!

1 Like

Wow, thanks a lot. Very good hint, made it easy. Seems to be better now. Very nice.

1 Like

This is a list of all Browser tweaks I’ve made until now to speed up Browser:

I have to confess, this does NOT really solve the Browser crash or memory problem from the root, but crashing happens less often now and it speeds up the browser.

Actually I observe “f” at the end of several numbers in about config, e.g. apz.fling_stopped_threshold, apz.fling_accel_base_mult, apz.min_skate_speed. Are you sure the f is not intentional?

2 Likes

No I’m not sure, and I don’t really know what these settings really mean and in what context they really are with the well known SFOS Browser issues like slowness and the OOM killer issue.

I’m only guessing and trying and hoping I have good luck and find something and removing the f’s I had good luck and it did really bring speed gain. But I have to confess this was not out of real knowledge but only good luck and slowly I get sick of always the same problems of general system instability and self-blocking ‘security’ features of SFOS.

There are dozens of high skilled professional coders involved into the SFOS project and they didn’t make a simple Linux based OS with some simple apps working without permanent need to tweak and bugfix something and there always some bugs and malfunctions remaining that makes SFOS unreliable.

I don’t want to write more to this matter.

It’s probably a lazy programmer thing: I believe it’s a convention to get a higher precision float. That is, to get a 64 bit double instead of a 32 bit float. Why that would be needed in this case is anyone’s guess. In any case, that trailing f is used in java to get a 64 bit Double.

3 Likes

According to: gecko-dev/index.md at 600df6aa643726626d2eab36bc0f6e34bbe5ac2a · sailfishos-mirror/gecko-dev · GitHub

As I don’t see that ‘f’ anywhere in android firefox or desktop one, the conversion should happen automagically, I think this is leftover of how Qt inputs floats there, but it’s probably bening and getting ignored by libpref

EDIT: There are some quite recent bugs relating to parsing floats in preferences but not sure this relates to our version
https://phabricator.services.mozilla.com/D148305

2 Likes

These are two types of routines for handling floats, not from ints but from String. I have to admit, I’m suspicious. Even if you want to sanitize the input, the conversion is, most safely, std::stod in the standard library. Why *aRetVal = ParsePrefFloat(stringVal, &rv); But then, I’m probably just nitpicking.

The also do stuff like: return 0.f; which is, ok, same as return 0 on most compilers, but, why?!

There’s been some changes in 2019 to allow trailing chars in values ⚙ D42239 Bug 1573648 - Introduce ToDoubleAllowTrailingChars and ToFloatAllowTrailingChars. r?njn
But not sure this AllowTrailingCharsPolicy is used for about:config values (it seems to have been a workaround for a value from html with a trailing slash). These ToDouble/Float are being moved from one place to another multiple times… The changes/reverts from Jun/Dec 2022 are probably not in our gecko, the 2019 bit probably is, but it’s a quagmire

For me, browser crashes always seem to involve videos or images. Watching a video (frequent crashes), scrolling past an image whilst its loading (frequent crashes) or simply just image heavy web pages (less frequent crashes). Mainly text web pages hardly ever crash. Crashes often take other running native apps down as well (greyed out cover pages which then reload the app with a rotating circle) and also daemons as well (which of course you don’t know about until you find something later hasn’t worked).

Its a huge pain and I can’t understand why Jolla didn’t pick this obvious problem up in pre-release testing, especially for 4.5. I had thought that closing other open apps (i.e. Releasing more memory for the browser) might help, but it doesn’t seem to make any difference.

I had a look at the about:config settings and my settings for those mentioned above don’t have any trailing 'f’s - and nobody has tinkered with this setup before so it is as installed from a fresh flash. So not sure why mine are different.

3 Likes