opening 4 html files from the command line causes a noticable main process hang in mach_msg2_trap
Categories
(Toolkit :: Startup and Profile System, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | fixed |
People
(Reporter: mgaudet, Assigned: mossop)
References
Details
Attachments
(1 external file)
Note: I'm basically unable to reproduce this outside my main install at the moment. More details in a moment.
STR: Have a folder
macOS 15: Have a folder with ~20 HTML docs. do open *.html in a terminal
Expected: 20 tabs open almost instantly
Actual: Hang for ~2 min, only 5 tabs actually open.
Some profiles:
- All processes, low rate https://share.firefox.dev/48jKxUY
- some processes, higher rate: https://share.firefox.dev/4pit6dj
I'm opening in this component because the highest function in the call stack I can name is sendCommandLine
The actual time is spent in an OS frame much further down, mach_msg2_trap
Debugging notes:
- If I create a new profile with the profile manager, this reproduces
- I can reproduce in Troubleshooting Mode
- Version is 147.0a1 (2025-12-05) (aarch64)
- I cannot reproduce if I
- Launch with mozregression
- put a copy of firefox in ~/tmp, and launch with
open -a "$HOME/tmp/Firefox Nightly.app" *.html - Even if I create a new profile in the profile manager
- I can't reproduce on release, though like mozregression I basicallly just installed Release today.
for i inseq 0 20; do touch test_$i.html; done;is sufficient to test- It's interesting to me that I only ever get ~5 tabs.
| Reporter | ||
Comment 1•11 months ago
|
||
Oh, also I tried rebooting the machine -- this fixed an oddity I had been seeing with Safari, where a few tabs weren't loading correctly, but didn't fix firefox.
| Reporter | ||
Comment 2•11 months ago
|
||
Ah, interesting. Even opening 3 files is enough for a weird hang.
- 4 files: https://share.firefox.dev/4oId2Rd only two tabs actually opened.
| Reporter | ||
Comment 3•11 months ago
|
||
Ahh -- I tried opening 9 HTML files from Finder using "cmd-down"... same hang, and only 5 tabs opened.
| Reporter | ||
Comment 4•11 months ago
|
||
BUT! Dragging all 9 into the window worked fine!
Comment 5•11 months ago
|
||
Sounds like an OS issue...
| Assignee | ||
Comment 6•11 months ago
|
||
Based on the stack this would only reproduce if you've used the new profiles UI to create a profile.
Is Firefox already open when you trigger opening the files? If so how many profiles are running at once and in which one do the files open?
| Reporter | ||
Comment 7•11 months ago
|
||
- Firefox is already open
- I originally only tried reproducing with one (main) profile open. When I tried with the second profile open, the first time it was fast, and the files opened in the second (testing) profile. Now they open in the main profile and are slow again.
- The profile UI has only 3 profiles available.
| Assignee | ||
Comment 8•11 months ago
|
||
So this is probably an issue with the mitigation we added in bug 1945207 to open URLs passed to us by the OS in the most recently used profile. The problem is that the instance that receives the OS notification may not be the one we want to load the URLs into. So we do some async disk I/O to determine the correct instance and then use the remoting system to send a message over the CFMessagePort to have it handle the command line arguments.
But in the case where there is only one profile running we're actually sending a message to ourselves. In my testing this appeared to work fine but my guess is that it is working fine for a single message but when you start sending a bunch we are hitting some kind of lock contention. I do notice from the profiles that we spend almost an exact multiple of 10 seconds in mach_msg2_trap and the timeout we set on sending the message is 10 seconds.
We can probably fix this by skipping sending the message when the target profile is the current profile and just handle the command line arguments directly. I didn't do this originally because re-creating the command line and running it through all command line handlers isn't easy to do from JavaScript. However since the command line in question is quite simple we can probably get away with just parsing it ourselves and opening the URLs directly.
| Reporter | ||
Comment 9•11 months ago
|
||
Ok, glad to know there might be an actual issue here rather than my diagnosis which was "this profile is haunted" :)
| Assignee | ||
Comment 10•11 months ago
|
||
(In reply to Matthew Gaudet (he/him) [:mgaudet] from comment #9)
Ok, glad to know there might be an actual issue here rather than my diagnosis which was "this profile is haunted" :)
To be clear I can't reproduce myself so I'm somewhat guessing. But those 10s timings is suspicious and it is kinda silly that we use the remoting system to talk to the same process anyway so fixing that isn't a bad thing.
| Reporter | ||
Comment 11•11 months ago
|
||
Yeah, unfortunately it's hard for me to reproduce outside of my 'main' setup too, so 'might' was carrying a lot of weight in that comment.
Comment 12•11 months ago
|
||
The severity field is not set for this bug.
:mossop, could you have a look please?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 13•10 months ago
|
||
Updated•10 months ago
|
Comment 14•10 months ago
|
||
Comment 15•10 months ago
|
||
| bugherder | ||
| Assignee | ||
Comment 16•10 months ago
|
||
I'd be interested to hear if this fixes the issue for you
| Reporter | ||
Comment 17•10 months ago
•
|
||
Works perfectly. Every tab opened under a second even opening 95 html files. https://share.firefox.dev/4qeTGVd is a trimmed profile if you care.
Description
•