Skip to content

Commit 0167321

Browse files
authored
Lift the previous 100 max workers limit (#25410)
A long time ago, Firefox had a default limit of `dom.workers.maxPerDomain == 20`, and a hardcoded cap of `navigator.hardwareConcurrency` reporting 16 even on systems that would have more hardware threads. To work around those limits for Emscripten tests that hammered lots of Workers, we had bumped the default `dom.workers.maxPerDomain` limit from 20 up to 100. In [August 2016](mozilla-firefox/firefox@f6650e8#diff-8c2c5665d52eb6026c4017acc0c311c6d9cc6b2b8719f50c1539ee836f2ea361R97-R114), Firefox itself bumped the same default limit of `dom.workers.maxPerDomain` from 20 up to 512. Then in April of this year, Firefox [lifted the hardcoded cap](mozilla-firefox/firefox@af05ed3) of `navigator.hardwareConcurrency` from 16 up to 128. This means that the limit `user_pref("dom.workers.maxPerDomain", 100);` we now have is too small, and on a 256-thread workstation, caused attempting to spawn >100 Workers in the Pthread pool to hang, as 128 concurrent Workers would not be allowed. So remove the previous 100 max workers limit. Explicitly bump it up to the same default limit 512 that Firefox has to make the limit go away in testing older browsers as well. Fixes e.g. `browser.test_pthread_hardware_concurrency` on >128-thread workstations.
1 parent 27d725b commit 0167321

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

emrun.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,9 @@ def create_emrun_safe_firefox_profile():
229229
temp_firefox_profile_dir = tempfile.mkdtemp(prefix='temp_emrun_firefox_profile_')
230230
with open(os.path.join(temp_firefox_profile_dir, 'prefs.js'), 'w') as f:
231231
f.write('''
232-
// Lift the default max 20 workers limit to something higher to avoid hangs when page needs to spawn a lot of threads.
233-
user_pref("dom.workers.maxPerDomain", 100);
232+
// Old Firefox browsers have a maxPerDomain limit of 20. Newer Firefox browsers default to 512. Match the new
233+
// default here to help test spawning a lot of threads also on older Firefox versions.
234+
user_pref("dom.workers.maxPerDomain", 512);
234235
// Always allow opening popups
235236
user_pref("browser.popups.showPopupBlocker", false);
236237
user_pref("dom.disable_open_during_load", false);

test/firefox_user.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
// Lift the default max 20 workers limit to something higher to avoid hangs when page needs to spawn a lot of threads.
2-
user_pref("dom.workers.maxPerDomain", 100);
1+
// Old Firefox browsers have a maxPerDomain limit of 20. Newer Firefox browsers default to 512. Match the new
2+
// default here to help test spawning a lot of threads also on older Firefox versions.
3+
user_pref("dom.workers.maxPerDomain", 512);
34
// Always allow opening popups
45
user_pref("browser.popups.showPopupBlocker", false);
56
user_pref("dom.disable_open_during_load", false);

0 commit comments

Comments
 (0)