Closed Bug 1937367 Opened 1 year ago Closed 1 year ago

After resuming laptop from overnight sleep/standby/Lid Close, all pages intermittently stop loading for 1 minute(other browser on the same machine loads pages just fine)

Categories

(Core :: Networking, defect, P2)

defect

Tracking

()

VERIFIED FIXED
139 Branch
Tracking Status
firefox139 --- fixed

People

(Reporter: mayankleoboy1, Assigned: valentin)

References

Details

(Whiteboard: [necko-triaged][necko-priority-queue])

User Story

platform-scheduled:2025-12-31

Attachments

(7 files)

Profile with networking preset : https://share.firefox.dev/4gc8v6b

I was trying to open: https://treeherder.mozilla.org/perfherder/graphs?highlightAlerts=1&highlightChangelogData=1&highlightCommonAlerts=0&replicates=0&selected=83615,1917694797&series=autoland,83615,1,13&timerange=5184000&zoom=1733946312945,1734292815159,562.8531853231075,834.1984365042341

The page wont load... Then i tried opening google.com and that wouldnt load. Even the profile took a long time to capture.
I also sometimes get hang while shutting down the browser - I get the message "another instance of firefox is already running" message.

Filing under networking, but this may be due to other issues.

Attached file about:support β€”

This is with the latest Nightly only. It only reproduced a few times, and I dont see it anymore.
I suspect it was a "one-time" activity from the patches in Bug 1933053

Not able to replicate issue.

Operating System: openSUSE Leap 15.6
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Kernel Version: 6.4.0-150600.23.30-default (64-bit)
Graphics Platform: X11
Processors: 16 Γ— AMD Ryzen 7 PRO 6850HS with Radeon Graphics
Memory: 62.1 GiB of RAM
Graphics Processor: AMD Radeon Graphics
Manufacturer: HP
Product Name: HP EliteBook 865 16 inch G9 Notebook PC

Another profile with networking preset logging: https://share.firefox.dev/3ZvhvMs

This line in the markers from the last profile implies ublock origin was involved. This is the first event that happens when treeherder finally gets unblocked after sitting for 15+s

Extension Suspend - onBeforeRequest https://treeherder.mozilla.org/jobs?repo=try by uBlock0@raymondhill.net (chanId: 11132)

Can you try disabling uBlock Origin (and other extensions?)

Flags: needinfo?(mayankleoboy1)

I disabled ublock and could still repro : https://share.firefox.dev/4iINhyr
But as i saud, this is intermittent and started in the last 1-2 days only.

Flags: needinfo?(mayankleoboy1)
Attached file log.txt-main.22352.zip β€”

Networking log. I started logging just after startup. My usual profile with all addons.

In many such cases, when i close the browser and restart, I get the "Firefox is already running" message. When i force close Firefox and start Firefox again, network does not load.
I checked the "dependency cycle" using Windows task manager, and it said that Firefox was waiting to complete "Network I/O" on two threads of one of the Firefox processes (I chose the Firefox process with highest memory use so I am guessing it must be the parent-process)

Attached file log.txt-main.23060.zip β€”

OK, this should be hopefully a better log that i captured.

This contains the networking + websockets+http3 logging presets.

I started logging when pages opened normally. Then I did a bit of browsing. Then the pages stopped loading for maybe 15-20 seconds. Then they eventually all loaded.

This log captures all of that.

rjesup, was this useful?

Flags: needinfo?(rjesup)

This seem to occur after i resume my laptop after suspend/sleep. I specially notice this after i open my laptop in the morning after i close the lid in the night.
Only Firefox is affected. This may only occur on Win11 24H2 version.

See Also: → 1937771
Summary: Sometimes pages just stop loading (other browser on the same machine loads pages just fine) → After resuming laptop from overnight sleep/standby/Lid Cloe, all pages intermittently stop loading for 1 minute(other browser on the same machine loads pages just fine)
Summary: After resuming laptop from overnight sleep/standby/Lid Cloe, all pages intermittently stop loading for 1 minute(other browser on the same machine loads pages just fine) → After resuming laptop from overnight sleep/standby/Lid Close, all pages intermittently stop loading for 1 minute(other browser on the same machine loads pages just fine)

Here is another profile with network preset logging: https://share.firefox.dev/4ah8HP3

Flags: needinfo?(rjesup)
See Also: → 1941669

Could one of you take a look? Thanks

Severity: -- → S3
Flags: needinfo?(valentin.gosu)
Flags: needinfo?(kershaw)
Priority: -- → P2
Whiteboard: [necko-triaged][necko-priority-new]

Looking at the user triggered channels, they seem to be canceled by this stack:

XMLHttpRequest.abort
stopresource://gre/modules/SearchSuggestionController.sys.mjs:352:7
cancelQueryresource:///modules/UrlbarProviderSearchSuggestions.sys.mjs:320:14
js::RunScript

That said, I would have expected some DNS resolutions to happen, but I see none of that in the profile.
And the Socket thread is doing next-to-nothing.

@Mayank, thank you for this report.
If possible, could you start profiling before suspending the computer? Then capturing immediately after resuming?
Thanks!

Flags: needinfo?(valentin.gosu) → needinfo?(mayankleoboy1)
See Also: → 1872517

https://share.firefox.dev/4ampK2x

I started network preset logging . Then i closed down the lid and went to sleep. Woke up in the morning and captured the profile.
Let me know if it works for you.
Edit: I didnt try to open any page after waking up, which is why the profile is sort of empty. Will retry again tomorrow.

Flags: needinfo?(mayankleoboy1) → needinfo?(valentin.gosu)

(In reply to Mayank Bansal from comment #15)

https://share.firefox.dev/4ampK2x

I started network preset logging . Then i closed down the lid and went to sleep. Woke up in the morning and captured the profile.
Let me know if it works for you.
Edit: I didnt try to open any page after waking up, which is why the profile is sort of empty. Will retry again tomorrow.

The profile indicates that after 2025-01-21 01:48:08.381965576 UTC, all proxy resolutions are blocked, with the last successful resolution logged at that timestamp.

2025-01-21 01:48:08.381965576 UTC - [Parent Process 15988: GeckoMain]: D/nsHttp nsHttpChannel::OnProxyAvailable [this=2088ae17c00 pi=0 status=0 mStatus=0]

For example, TRR request 2089037f100 attempts to resolve the proxy at 01:48:08.402730712 UTC but is subsequently canceled, as shown in the logs. Could you please add proxy:5 to the MOZ_LOG environment variable and capture the HTTP logs again? Additionally, are you able to reproduce this issue using a clean profile?

2025-01-21 01:48:08.402730712 UTC - [Parent Process 15988: GeckoMain]: D/nsHttp TRRServiceChannel::ResolveProxy [this=2089037f100]
2025-01-21 01:48:09.886917480 UTC - [Parent Process 15988: TRR Background]: D/nsHttp TRRServiceChannel::Cancel [this=2089037f100 status=804b0055]
2025-01-21 01:48:09.887862792 UTC - [Parent Process 15988: GeckoMain]: D/nsHttp TRRServiceChannel::OnProxyAvailable [this=2089037f100 pi=0 status=804b0055 mStatus=804b0055]
Flags: needinfo?(kershaw) → needinfo?(mayankleoboy1)
Flags: needinfo?(valentin.gosu)

I have tried to get a profile for the last two days by starting the profiler, suspending, and then capturing the profile in the morning.
However, on resuming the browser, it is able to connect to the network. Maybe the act of keeping the browser open and profiler running prevents my laptop from truely suspending?
(keeping the needinfo)

Flags: needinfo?(mayankleoboy1)
Flags: needinfo?(mayankleoboy1)

Valentin, I have been trying to repro for 3 days now. But it looks like if I keep Firefox open when closing the lid of my laptop, on waking up Firefox can access network normally. So I think to repro this issue, I need to close Firefox.
What can I try next here?

Flags: needinfo?(mayankleoboy1) → needinfo?(valentin.gosu)

How did you capture the profile before? Does that method still work?
It would be good if you also manage to add proxy:5 to the module list.

Flags: needinfo?(valentin.gosu) → needinfo?(mayankleoboy1)

(In reply to Valentin Gosu [:valentin] (he/him) from comment #19)

How did you capture the profile before? Does that method still work?
It would be good if you also manage to add proxy:5 to the module list.

Previously, i would close Firefox and let the laptop suspend. Then in the morning i would start firefox and capture logs. that should still work i guess. (So basically capture the log just after startup). I will add proxy:5. I will capture something tomorrow morning.

Is there a way to log during startup? Some sort of logging that begins with the launch of the browser?

Flags: needinfo?(mayankleoboy1) → needinfo?(valentin.gosu)

Hmmm.... https://firefox-source-docs.mozilla.org/networking/http/logging.html may be onto something

I will try using this command line argument:

"c:\Program Files\Mozilla Firefox\firefox.exe" -MOZ_LOG=nsSocketTransport:5,EarlyHint:5,neqo_transport:::3,nsWebSocket:5,nsHostResolver:5,cache2:5,neqo_http3:::5,nsHttp:5,proxy:5,timestamp,sync,profilerstacks -MOZ_LOG_FILE=%TEMP%\log.txt

Should I add the "profilerstacks" at the end? Does this look correct to you?

Ah, I understand now.
Yes, getting the proxy:5 logs even after the resume may help us find the problem.
Don't think logging the browser startup would help here - but you can do it with the MOZ_LOG env variable. You can even profile during startup https://profiler.firefox.com/docs/#/./guide-startup-shutdown

Flags: needinfo?(valentin.gosu)
Flags: needinfo?(mayankleoboy1)
Flags: needinfo?(mayankleoboy1) → needinfo?(valentin.gosu)

Looking at the logs, I see:

2025-01-29 15:37:20.129000 UTC - [Parent 30008: Main Thread]: V/nsHttp TRRServiceChannel::ResolveProxy [this=1e4c5033a00]
...
2025-01-29 15:37:21.696000 UTC - [Parent 30008: TRR Background]: D/nsHostResolver TRR: 1e4c50efb60 canceling Channel 1e4c5033a40 bugzilla.mozilla.org 28 status=804b0055
2025-01-29 15:37:21.696000 UTC - [Parent 30008: TRR Background]: V/nsHttp TRRServiceChannel::Cancel [this=1e4c5033a00 status=804b0055]
...
2025-01-29 15:37:21.696000 UTC - [Parent 30008: Main Thread]: D/proxy pac thread callback did not provide information 804B0055

later:

2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/nsHttp nsHttpChannel::ResolveProxy [this=1e4c598d400]
2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/proxy nsPACMan::AsyncGetProxyForURI reload as scheduled
2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/proxy nsPACMan::LoadPACFromURI aSpec: , aResetLoadFailureCount: false
2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/proxy network.proxy.type pref retrieved: 4
2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/proxy network.proxy.type pref retrieved: 4
2025-01-29 15:38:33.329000 UTC - [Parent 30008: Main Thread]: D/proxy pac not available, use DIRECT

Mayank says the configured proxy setting was auto detect proxy settings for this network, so presumably the OS settings are configured for WPAD.
The proxy code isn't LOGging too much, so I assume the problem is somewhere in the proxy code. We're probably encountering an error, but not calling the callback.

I asked Mayank to also test with no proxy

Flags: needinfo?(valentin.gosu)

Mayank reports that setting the proxy to no proxy got rid of the resume hang.

See Also: → 1882051

I think we need to add more proxy logging to figure out what is erroring after resume.

Whiteboard: [necko-triaged][necko-priority-new] → [necko-triaged][necko-priority-next]
User Story: (updated)
Whiteboard: [necko-triaged][necko-priority-next] → [necko-triaged][necko-priority-queue]
Keywords: leave-open

Also removes unused nsAsyncBridgeRequest

Assignee: nobody → valentin.gosu
Status: NEW → ASSIGNED

I went through the most recent logs and found the following:

// First call to ResolveProxy
2025-01-29 15:37:20.127000 UTC - [Parent 30008: TRR Background]: V/nsHttp TRRServiceChannel::ResolveProxy [this=1e4c5033a00]
...
// Call failed
2025-01-29 15:37:21.696000 UTC - [Parent 30008: TRR Background]: V/nsHttp TRRServiceChannel::Cancel [this=1e4c5033a00 status=804b0055]
...
// This thread is blocked maybe?
2025-01-29 15:38:22.629000 UTC - [Parent 30008: ProxyResolution]: D/proxy nsPACMan::GetPACFromDHCP DHCP option 252 query failed with result -2147221231
....
2025-01-29 15:38:27.651000 UTC - [Parent 30008: Main Thread]: D/proxy OnStreamComplete: entry
2025-01-29 15:38:27.651000 UTC - [Parent 30008: Main Thread]: D/proxy OnStreamComplete: unable to load PAC, retry later
2025-01-29 15:38:27.651000 UTC - [Parent 30008: Main Thread]: D/proxy OnLoadFailure: retry in 5 seconds (1 fails)
...
2025-01-29 15:38:27.712000 UTC - [Parent 30008: Main Thread]: V/nsHttp TRRServiceChannel::OnProxyAvailable [this=1e4b370da00 pi=0 status=0 mStatus=0] (first good)

I looked around for some info about GetPACFromDHCP getting stuck, and found this chrome bug: Chrome hangs after waking up from sleepswitching network when using proxy auto-detect and have virtual adapters enabled 40542477 which seems to describe a very similar issue.

I think the problem is that DhcpRequestParams is hanging simlar to Chrome, and this is blocking the ProxyResolution thread here.

Chrome uses multiple threads to avoid hanging. I'm wondering if we could execute this on a background thread that is not the ProxyResolution thread instead.

Pushed by sstanca@mozilla.com: https://hg.mozilla.org/mozilla-central/rev/bbff13f39637 Extra proxy logging r=necko-reviewers,kershaw
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/be8fed2bb18f Make sure to not query local or offline adapters r=necko-reviewers,kershaw

Mayank, once this gets merged to central, I'd appreciate it if you tried to reproduce again and captured another profile.
Add dhcpUtils:5 to the modules list.
Thanks!

Flags: needinfo?(mayankleoboy1)
Regressions: 1949442

(In reply to Valentin Gosu [:valentin] (he/him) from comment #33)

Mayank, once this gets merged to central, I'd appreciate it if you tried to reproduce again and captured another profile.
Add dhcpUtils:5 to the modules list.
Thanks!

shared the logs privately on chat.

Flags: needinfo?(mayankleoboy1) → needinfo?(valentin.gosu)

Just for clarity: I can still repro this.

Thanks. I'll have a look at fixing this next week. It does seem to match Chrome's problem exactly, with DhcpRequestParams hanging.

I intend to call DhcpRequestParams and have the ProxyResolution thread wait on a condition variable with a timeout.

Flags: needinfo?(valentin.gosu)

(Commenting on User Story)

platform-scheduled:2025-12-31

User Story: (updated)
Keywords: leave-open
Pushed by valentin.gosu@gmail.com: https://hg.mozilla.org/integration/autoland/rev/52339d7235b9 Add timeout when calling DhcpRequestParams to get proxy settings r=necko-reviewers,sunil
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 139 Branch

I havent reproduced this issue after the latest patch.

QA Whiteboard: [qa-triage-done-c140/b139]

Marking verified based on comment 42

Status: RESOLVED → VERIFIED
See Also: → 1866944
Regressions: 1964064
See Also: → 1869403
See Also: → 1964030
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: