On Windows, profiler doesn't capture gecko log properly in MFCDM process
Categories
(Core :: Gecko Profiler, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox141 | --- | fixed |
People
(Reporter: alwu, Assigned: alwu)
References
(Blocks 1 open bug)
Details
(Whiteboard: [fp])
Attachments
(2 external files, 1 obsolete file)
When opening about:support on Widows Nightly, you can see a section called "Content Decryption Modules Information". That triggers this part of code, which should result in printing logs in the BackgroundThreadPool thread. But if you use media playback in about:logging to profile this behavior, there is NO log at all on that thread.
STR.
- go to
about:logging - select
media playbackpreset and start profiling - go to
about:supportand wait untilContent Decryption Modules Informationshows some results - stop profiling
Expected.
5. log should be captured on BackgroundThreadPool in the MFCDM process
Actual.
5. no log at all
| Assignee | ||
Comment 1•2 years ago
|
||
FYI we also received different several profiled results from Windows users before, and also no the log message in their profiled result. There must be something wrong on Windows.
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Comment 2•2 years ago
|
||
I started debugging this and saw the prefs are propagated to the child process, and everything seemed fine, but then then logging I saw the level at 0 (disabled), and got confused and had to switch to something else.
| Assignee | ||
Comment 3•2 years ago
|
||
On today's Nightly, this bug still persists and I still can't see any log in BackgroundThreadPool. However, another user captured a profile on build id 20241024094434, his profile can capture logs successfully, not sure why...
Comment 4•2 years ago
|
||
There is a race somewhere, this needs more debugging.
Comment 5•1 year ago
|
||
Alastor I don't see any log message on the main thread either, but maybe that's expected because there's no moz_log call there, can you please confirm?
Also can you confirm you see these logs in the console even when they're not showing up in the profile?
Thanks
Registering the modules is done in LogModulePrefWatcher.cpp:
https://searchfox.org/mozilla-central/rev/a547d790fa7facb8d0addb9197797dc52b31e8f2/xpcom/base/LogModulePrefWatcher.cpp#158-170
Adding the marker is done in https://searchfox.org/mozilla-central/rev/a547d790fa7facb8d0addb9197797dc52b31e8f2/xpcom/base/Logging.cpp#675-681
Adding a breakpoint with printing at these locations could maybe help debugging?
| Assignee | ||
Comment 6•1 year ago
|
||
Alastor I don't see any log message on the main thread either, but maybe that's expected because there's no moz_log call there, can you please confirm?
Yes, logs are not in the main thread. They are mostly on BackgroundThreadPool, MediaSupervisor and MediaPDecoder.
Also can you confirm you see these logs in the console even when they're not showing up in the profile?
No.
After doing some more testing, it seems like the issue with missing logs only occurs when the MFCDM process hasn't been started before starting the profiler. Once the MFCDM process has already been created, the profiler is able to capture logs normally.
This suggests that when the MFCDM process is created after profiling starts, the profiler might not be registering the log modules correctly within that process.
You can reproduce the issue using the following STR (on Windows):
- Start Firefox
- Go to
about:logging, select theMedia Playback preset, and start capturing - Visit
about:support - Once the page finishes loading, stop profiling
- In the profile, you should see the
MF Media Engine CDMprocess, but no logs in theBackgroundThreadPoolthread - Start a new profiling via
about:loggingagain - Refresh the
about:supportpage - Once it finishes loading, stop profiling
- In the new profile, you should now see the
MF Media Engine CDMprocess with logs underBackgroundThreadPool
Comment 7•1 year ago
|
||
(In reply to Alastor Wu [:alwu] from comment #6)
Alastor I don't see any log message on the main thread either, but maybe that's expected because there's no moz_log call there, can you please confirm?
Yes, logs are not in the main thread. They are mostly on
BackgroundThreadPool,MediaSupervisorandMediaPDecoder.Also can you confirm you see these logs in the console even when they're not showing up in the profile?
No.
Then I think it's not related to the profiler at all, but to the more generic log system.
All about:logging does is setting some preferences.
Does that all work when you use the MOZ_LOG env variable?
| Assignee | ||
Comment 8•1 year ago
|
||
(In reply to Julien Wajsberg [:julienw] from comment #7)
Then I think it's not related to the profiler at all, but to the more generic log system.
All about:logging does is setting some preferences.
Does that all work when you use the MOZ_LOG env variable?
Yes, using MOZ_LOG works, but adding logging.XXX doesn't. It does sound like a MOZLOG problem, do you know who the right person is to ask for checking this issue? Thanks!
Comment 9•1 year ago
|
||
More or less me. I would set breakpoints around here: https://searchfox.org/mozilla-central/source/xpcom/base/LogModulePrefWatcher.cpp#175. This is the code that is responsible for catching any modification to logging.xxx and set the log module appropriately.
| Assignee | ||
Comment 11•1 year ago
|
||
Okay, I found the issue. The log modules are correctly created and initialized with the appropriate log level when the MFCDM process is launched. However, the log level gets cleared by this code afterward. The subsequent code that sets the log level only considers the MOZ_LOG environment variable and the preference, and doesn’t reapply the levels set via about:logging. As a result, any modules configured through about:logging aren't properly restored.
This issue might also explain why we sometimes don’t see media logs from users, even when they’ve reported capturing the profile using the media preset.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 12•1 year ago
|
||
If the logging.config.modules preference is empty, we should avoid clearing
the existing log modules. Resetting them unnecessarily can result in losing log
levels previously set via about:logging.
Comment 13•1 year ago
|
||
ah right, good find!
Moving forward I'd like to make about:logging use logging.config.modules directly, which would also prevent the issue.
But developers might still use the individual prefs for reasons so I think this fix makes sense anyway, even in the long run.
| Assignee | ||
Comment 14•1 year ago
|
||
| Assignee | ||
Comment 15•1 year ago
|
||
Updated•1 year ago
|
Comment 17•1 year ago
|
||
Comment 18•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/4a6f86123276
https://hg.mozilla.org/mozilla-central/rev/bd4a1034914b
Updated•1 year ago
|
Updated•7 months ago
|
Description
•