Closed Bug 1768825 Opened 4 years ago Closed 4 years ago

Firefox becomes unresponsive on M1 when performing large build tasks in background

Categories

(Firefox Build System :: General, defect)

Firefox 101
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1670885

People

(Reporter: tcsc, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:101.0) Gecko/20100101 Firefox/101.0

Steps to reproduce:

On an M1 Mac, start building a large project (like LLVM or rustc) on many cores, and then try to use firefox at the same time.

Actual results:

Some of the time, especially if doing a release build, Firefox will stop responding to user input and get the spinning beachball. It stays like this for several minutes, and then once the build dies down, things come back to normal.

Warning: Backseat speculation below.

If I sample the process while it's stuck, it shows a lot of time is spent in OSSpinLockLock inside mozjemalloc. It seems plausible that the scheduling changes on the M1 don't work well with pure spinlocks.

So, while I have not tried to see if this fixes it, os_unfair_lock was added in MacOS 10.12 (see https://developer.apple.com/documentation/os/os_unfair_lock_t). It's significantly better behaved than OSSpinLock, and while it may not fix the issue, it seems plausible that it might, and I think it would be a very simple change (I think it might just be https://gist.github.com/thomcc/c73b8216b21d1273f3330fb68b027037? (feel free to take that patch, or not. TBH, I can't be assed to set up phabricator now that I've left), but I haven't checked if there's anything else.

FWIW OSSpinLock is deprecated in favor of os_unfair_lock, so it's worth getting off when you have a chance, maybe.

(And to be clear, 10.12 is within the system requirements according to https://www.mozilla.org/en-US/firefox/100.0/system-requirements/ -- and is several versions under the requirement on aarch64-apple-darwin, which is the only place I've seen the issue)

Expected results:

It'd be okay if it was slower -- that's expected. But it shouldn't be unresponsive like this for several minutes.

The Bugbug bot thinks this bug should belong to the 'Firefox Build System::General' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → General
Product: Firefox → Firefox Build System
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.