Firefox main window freezed : parent firefox process switched to background process priority (Low IO and Memory Priority) , Windows 10 64bit
Categories
(Core :: Widget: Win32, defect)
Tracking
()
People
(Reporter: Robert_Hartmann, Unassigned)
References
Details
Attachments
(1 file)
|
132.92 KB,
image/png
|
Details |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:155.0) Gecko/20100101 Firefox/155.0
Steps to reproduce:
Firefox had only open one tab and visible bookmark-side menue
I was reading https://bugzilla.mozilla.org/show_bug.cgi?id=2068836
Actual results:
Firefox freezed.
Windows show "waiting for process"
In ProcessExplorer I could see, that the priority of firefox main process was switched to background process priority (Low IO and Memory Priority) => see attached screenshot.
So this case is the opposite of bug https://bugzilla.mozilla.org/show_bug.cgi?id=2040255 , where Firefox consumes nearly all CPU.
Changing process priority via ProcessExplorer to "high" Firefox main window get responsible and webpage where rendered
Expected results:
Firefox should not freeze , should response to Windows WindowMessages , firefox main process should not fall to backgroud priority if some Webpages get shown in maximised window.
Fair enough would be switching firefox to background if browser window gets minimized oder overlayed and hidden from other application.
| Reporter | ||
Comment 1•1 month ago
|
||
Interesting discussion about low-memory detection : bug 1782178
Comment 2•1 month ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Widget: Win32' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 3•1 month ago
|
||
This is very likely AV or some other Windows system utility that is setting priority based on some dumb policy, like the process was using a lot of memory. Firefox won't reduce the parent process priority, so something else is doing it. Try disabling AV software or other weird utilities that might be affecting other software. Let us know if that helps.
Updated•1 month ago
|
| Reporter | ||
Comment 4•1 month ago
|
||
perhaps it is usefull to get a debugging information in error console about "downgrading priority" of main process?
https://learn.microsoft.com/de-de/windows/win32/api/processthreadsapi/nf-processthreadsapi-getpriorityclass
| Reporter | ||
Comment 5•1 month ago
|
||
(In reply to David Parks [:handyman] from comment #3)
Firefox won't reduce the parent process priority, so something else is doing it.
Well, thanks for the link. The enum value for PROCESS_PRIORITY_PARENT_PROCESS is defined in HalTypes.h.
But these value does not match with the values defined in Windows Process priority definition:
- https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setpriorityclass
- https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities
- https://learn.microsoft.com/en-us/answers/questions/4199676/how-do-i-set-affinity-and-priority-for-program-per
Somewhere in the code must be a matching part between the enum from firefox-main/source/hal/HalTypes.h to the Windows values.
I could not find it. Perhaps there is some mismatch?
| Reporter | ||
Comment 6•1 month ago
|
||
How to activate the HAL_LOG output, which is used in https://searchfox.org/firefox-main/source/hal/windows/WindowsProcessPriority.cpp ?
Comment 7•1 month ago
|
||
(In reply to Robert Hartmann from comment #5)
Somewhere in the code must be a matching part between the enum from firefox-main/source/hal/HalTypes.h to the Windows values.
I could not find it. Perhaps there is some mismatch?
The code you are looking for is here, but it does the opposite of what you say, because you are suggesting that this maps to a process priority, and my point was that Fx doesn't set the main process' priority. It is another application. If you want to view the HAL log, go to about:logging and add "hal:5" (all lower case) to the comma-separated "New Log Modules" list. Collecting the log with the Firefox profiler is probably the most user-friendly option -- if you do, log messages will be visible in the Marker Table.
| Reporter | ||
Comment 8•1 month ago
|
||
(In reply to David Parks [:handyman] from comment #7)
The code you are looking for is here, but it does the opposite of what you say, because
Well, I think, the code beginns some lines above: here is the implicite matching between PROCESS_PRIORITY_PARENT_PROCESS and Windows NORMAL_PRIORITY_CLASS.
My understanding of MS docs is: If FileExplorer starts a Process with NORMAL_PRIORITY_CLASS and FileExplorer somehow downgrades than all child Processes like Firefox, thunderbird ... also downgrades ...
Perhaps I am wrong?
Taken from https://learn.microsoft.com/en-us/windows/win32/procthread/scheduling-priorities :
By default, the priority class of a process is NORMAL_PRIORITY_CLASS. Use the CreateProcess function to specify the priority class of a child process when you create it. If the calling process is IDLE_PRIORITY_CLASS or BELOW_NORMAL_PRIORITY_CLASS, the new process will inherit this class.
[...]
A typical strategy is to use THREAD_PRIORITY_ABOVE_NORMAL or THREAD_PRIORITY_HIGHEST for the process's input thread, to ensure that the application is responsive to the user. Background threads, particularly those that are processor intensive, can be set to THREAD_PRIORITY_BELOW_NORMAL or THREAD_PRIORITY_LOWEST, to ensure that they can be preempted when necessary.
Comment 9•1 month ago
|
||
Ah, thanks for that. I missed that code but my understanding of the behavior is unchanged -- we don't change the parent process priority. The process shouldn't be participating in EcoQoS, so I don't have a theory beyond external applications. It doesn't make much sense that FileExplorer would see downgraded priority but it is not Firefox's parent (you can see this, for example, in Process Explorer). This is because Firefox's launcher process creates it unparented. The system could be dropping the priority anyway. There isn't really a way to find out what is changing the priority but there are Windows logs that record (only) that such events occurred. There are also applications (like Bill2's Process Manager or Process Lasso) that brute force Windows to "lock" firefox.exe with a certain priority, which may be a good option, given your extreme case, but they are also the kinds of tools that commonly create these kinds of problems.
Description
•