Gentoo Archives: gentoo-user

From: Kai Krakow <hurikhan77@×××××.com>
To: gentoo-user@l.g.o
Subject: [gentoo-user] Re: Firefox occasionally stalls
Date: Tue, 21 Mar 2017 20:17:41
Message-Id: 20170321211604.1d906868@jupiter.sol.kaishome.de
In Reply to: Re: [gentoo-user] Re: Firefox occasionally stalls by Alan McKinnon
1 Am Tue, 21 Mar 2017 21:51:05 +0200
2 schrieb Alan McKinnon <alan.mckinnon@×××××.com>:
3
4 > On 21/03/2017 21:50, Kai Krakow wrote:
5 > > Am Tue, 21 Mar 2017 21:35:36 +0200
6 > > schrieb Alan McKinnon <alan.mckinnon@×××××.com>:
7 > >
8 > >> This post is rather vague, sorry about that in advance.
9 > >>
10 > >> I've spent much time on this and gotten absolutely nowhere. So I
11 > >> conclude all my thoughts and assumptions are wrong and not worth
12 > >> even sharing (on account of them being so wrong).
13 > >>
14 > >> I have firefox like this:
15 > >>
16 > >> [I] www-client/firefox
17 > >> Available versions: 45.7.0^d 45.8.0^d (~)51.0.1^d {bindist
18 > >> custom-cflags custom-optimization dbus debug ffmpeg +gmp-autoupdate
19 > >> +gstreamer gtk2 hardened hwaccel jack +jemalloc +jemalloc3 +jit
20 > >> neon pgo pulseaudio rust selinux +skia startup-notification
21 > >> system-cairo system-harfbuzz system-icu system-jpeg
22 > >> system-libevent system-libvpx system-sqlite test wifi L10N="ach af
23 > >> an ar as ast az be bg bn-BD bn-IN br bs ca cak cs cy da de dsb el
24 > >> en-GB en-ZA eo es-AR es-CL es-ES es-MX et eu fa ff fi fr fy ga gd
25 > >> gl gn gu he hi hr hsb hu hy id is it ja ka kk km kn ko lij lt lv
26 > >> mai mk ml mr ms nb nl nn or pa pl pt-BR pt-PT rm ro ru si sk sl
27 > >> son sq sr sv ta te th tr uk uz vi xh zh-CN zh-TW"} Installed
28 > >> versions: 51.0.1^d(21:30:20 21/02/2017)(dbus gmp-autoupdate
29 > >> jemalloc pulseaudio skia startup-notification system-harfbuzz
30 > >> system-icu system-jpeg system-libevent system-libvpx system-sqlite
31 > >> wifi -bindist -custom-cflags -custom-optimization -debug -gtk2
32 > >> -hardened -hwaccel -jack -neon -pgo -rust -selinux -system-cairo
33 > >> -test L10N="en-GB en-ZA -ach -af -an -ar -as -ast -az -bg -bn-BD
34 > >> -bn-IN -br -bs -ca -cak -cs -cy -da -de -dsb -el -eo -es-AR -es-CL
35 > >> -es-ES -es-MX -et -eu -fa -ff -fi -fr -fy -ga -gd -gl -gn -gu -he
36 > >> -hi -hr -hsb -hu -hy -id -is -it -ja -ka -kk -km -kn -ko -lij -lt
37 > >> -lv -mai -mk -ml -mr -ms -nb -nl -nn -or -pa -pl -pt-BR -pt-PT -rm
38 > >> -ro -ru -si -sk -sl -son -sq -sr -sv -ta -te -th -tr -uk -uz -vi
39 > >> -xh -zh-CN -zh-TW") Homepage: http://www.mozilla.com/firefox
40 > >> Description: Firefox Web Browser
41 > >>
42 > >> with these plugins:
43 > >> - adblockplus
44 > >> - flashblock
45 > >> - foxyproxy standard
46 > >> - restart browser
47 > >> - user agent switcher
48 > >> - youtube all html5
49 > >>
50 > >> Occasionally, according to no discernable pattern, all my tabs on
51 > >> all some/most/all Firefox windows stop responding. Clicking and
52 > >> scrolling in the content has no effect. Can't open new tabs, can't
53 > >> close tabs, can't switch to existing tabs. Sometimes it affects
54 > >> only one firefox window, sometimes all firefox windows.
55 > >>
56 > >> Imagine if you will that firefox is coded with one global loop that
57 > >> gets user actions and responds, then that loop gets stuck
58 > >> somewhere. The firefox window will not be affected (controlled by
59 > >> KDE), and neither is the X-server but the tabs can all do nothing
60 > >> till the loop unsticks. It's an effect like that.
61 > >>
62 > >> Sometimes it does work after a delay >30s.
63 > >> The sysadmin in me says 30s? Hah, check DNS resolver timeouts.
64 > >> Checked, found nothing unusual. Proxy looks OK, VPN looks OK,
65 > >> Chrome never has this problem so it's firefox specific.
66 > >>
67 > >> Firefox itself is up, it responds correctly to moving around the
68 > >> menus, just can't do some of the actions like open the Addons page
69 > >> (that is regular content in a tab).
70 > >>
71 > >> The issue ALWAYS goes away if I restart firefox, either with the
72 > >> restart addon or Alt-F4 and start from KDE menu. I have "load
73 > >> previous tabs" set to true so those actions are pretty equivalent.
74 > >>
75 > >> DE is Plasma 5, and the problem isn't from a recent upgrade, I've
76 > >> been battling with this for ages through MANY kde and firefox
77 > >> updates.
78 > >>
79 > >> My question:
80 > >> Where the hell do I start to figure out what's really going on?
81 > >> I used up all my sysadmin troubleshooting knowledge and have had to
82 > >> revert back to n00b status on this one.
83 > >
84 > > I didn't use Firefox in a long time but remember similar effects
85 > > until I stopped using AdBlock Plus (Chrome showed similar stalls
86 > > with it, just not completely blocking, only one tab blocking). If
87 > > this is what affects you, maybe try Ghostery instead (which is what
88 > > I am using with Chrome now).
89 > >
90 > > If it doesn't help, deactivate the next addon. Every addon hooking
91 > > into web site rendering can create such problems easily, so start
92 > > with those addons first.
93 > >
94 >
95 >
96 > Good advice I'll do that.
97 >
98 > But, I did do that test already and disabled all addons a while ago,
99 > problem still happened. I won't swear I did the test properly, maybe
100 > I made a mistake.
101 >
102 > Still, it's worth repeating just make sure
103
104 Test one by one... Either disable all, then enable one by one, or
105 vice-versa.
106
107 Chances are that your FS may be blocking on sync. Do you maybe have a
108 very high value in /proc/sys/vm/dirty_background_{ratio,bytes}?
109
110 If ratio is 0, then bytes is used. Ratio is a percent of your physical
111 RAM. With the default kernel value in modern systems, this is
112 ridiculously high for desktop systems. Maybe put a fixed value, like
113 128MB. The dirty background value is the amount of outstanding writes
114 before a foreground process blocks on further writes. If this value is
115 high, a sync may cause processes to freeze for a long time. Setting
116 this to a lower value forces single processes to block early and give
117 the kernel a chance to write back dirty data.
118
119 The next value to check is dirty_{ratio,bytes}. That is the combined
120 maximum of outstanding data before the cache must be flushed. If this
121 is hit, all writing processes freeze. So, having the background value
122 high gives a greater chance of hitting this early.
123
124 The default values are 10% and 20% (ratio). I've made the 20% ratio
125 into 10% and put 128MB for background which works quite well:
126 Foreground processes are blocked for shorter times (because writing
127 128MB can be a few seconds or less, where 1.6GB can be minutes in a
128 worse case, so if overall limit is hit, I'm screwed). The overall
129 dirty buffer is still big enough to let the system buffer writes of
130 multiple processes. My system has 16GB RAM, you may want to adjust it
131 or try different values.
132
133 $ cat /etc/sysctl.d/98-caching.conf
134 vm.dirty_background_bytes = 134217728
135 vm.dirty_ratio = 10
136
137 Maybe point your Firefox cache to a tmpfs. If you're using tmpfs, don't
138 put swappiness to low, otherwise data sitting in tmpfs cannot be
139 swapped out and will cause filesystem caches to be discarded to early.
140 I'm working with a 32GB tmpfs and standard swappiness for emerge, and I
141 see no problems although multiple gigabytes of emerge build data may be
142 swapped out. Still, emerge is so much faster now. But then, my swaps
143 are on different disks (and I have multiple for getting some RAID-like
144 striping of swap space).
145
146 Also, depending on which FS you're using, trying deadline instead of
147 CFQ may greatly improve your desktop experience (browsers should
148 benefit most from this).
149
150 --
151 Regards,
152 Kai
153
154 Replies to list-only preferred.

Replies

Subject Author
Re: [gentoo-user] Re: Firefox occasionally stalls Alan McKinnon <alan.mckinnon@×××××.com>