Closed Bug 1547977 Opened 5 years ago Closed 5 years ago

Frequent "Unable to connect" when using automatic proxy configuration URL

Categories

(Core :: Networking, defect, P2)

68 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla70
Tracking Status
firefox-esr68 --- fixed
firefox68 --- wontfix
firefox69 --- fixed
firefox70 --- fixed

People

(Reporter: milan.kardos2, Assigned: jandem)

References

Details

(Whiteboard: [necko-triaged])

Attachments

(3 files)

Build ID:20190429215338
Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0

the issue is back again - we are using PAC file for network configuration and after some time the external addresses stop working due to timeout. opening the network configuration and pressing the reload button near the PAC file location box will restore connectivity.

Could you attach the log and append the MOZ_LOG environment variable with proxy:5
See instructions here: https://developer.mozilla.org/en-US/docs/Mozilla/Debugging/HTTP_logging

If it takes times to reproduce, add rotate:200 to limit the log size to 200MB

Flags: needinfo?(milan.kardos2)

i will add log on thursday.

Flags: needinfo?(milan.kardos2)

I'll leave the ni on you until the logs are provided, thanks.

Flags: needinfo?(milan.kardos2)
Attached file log with proxy:5
Flags: needinfo?(milan.kardos2)

(In reply to milan.kardos2 from comment #4)

TRR cancels lots of http channels, which generates noises.
I'd like to ask some questions to ease the investigation:
(a) What url you failed to connect in this log?
(b) You reloaded the PAC file about 3 minutes before the end of log, and it works well after. Is that right?

Thanks!

Flags: needinfo?(milan.kardos2)

a) f.e https://www.sme.sk/, https://dennikn.sk/, https://gulas.sme.sk/vsetko/, http://forums.mozillazine.org/viewforum.php?f=23 (now really not sure which one during logging time ...)
b) yes after PAC reload it works fine for some time ...

Flags: needinfo?(milan.kardos2)

2019-05-02 06:28:07.803000 UTC - [Parent 18444: ProxyResolution]: D/proxy Use proxy from PAC:
2019-05-02 06:28:07.803000 UTC - [Parent 18444: Main Thread]: D/proxy pac thread callback did not provide information 0

No proxy indicated in the last minute you reset the PAC file.
Which way did you set the pac file, about:preferences/os system setting/extension?

Flags: needinfo?(milan.kardos2)

PAC was set via Options/General/Network Settings/Settings dialog

Flags: needinfo?(milan.kardos2)

Honza, can you take a look at the logs since Junior is ooo, and maybe make a decision how we should proceed? Thanks!

Flags: needinfo?(honzab.moz)

Some of the responses (failing with 804b000e) simply don't get a proxy (as if the script was failing to evaluate). It's not true that reload of the wpad script helps. I can see hangouts.google.com requests that fail but also start working long before the request for the wpad (reload of it) is made.

Any errors in the browser console? Shift-Ctrl-J. You can filter for PAC.

Can you provide about:support page content? I want to eliminate any webext influence, because the proxy resolution results are filtered.

Note that the code is quite under-logged; w/o good logging it will be hard to figure this out if web extensions are ruled out. I think only way forward is to add more logging and provide a test build to run and try to reproduce.

Flags: needinfo?(honzab.moz)
Flags: needinfo?(milan.kardos2)

Hey, I'm also experiencing this bug.

Similar to initial reporter, my company is WPAD to configure proxy usage. After a while all external connections will stop working as the proxy is not resolved anymore. After creating and checking the log file I see the same behavior: suddenly the ProxyResolution is not providing the proxy anymore.

Checking my browser console I see a huge number of these:
PAC Execution Error: uncaught exception: out of memory []

Somehow I have the suspicion that this is closely related to the ProxyResolution being unresponsive after some time (or better after some connections)

For me the most convenient way to reproduce this bug is using google maps with satellite images. Simply scrolling around and loading a lot of images will rather sooner than later result in losing the proxy configuration.
To rule out any possible influence by addons and whatnot, I was testing it with a pretty pure Firefox 68.0.1 (64bit) with only SAML-tracer installed. (I previously suspected our proxy to be the culprit)

Let me know if the need for further information arises :)

Aww crap. It seems that our PAC file is part of the problem. In it a pretty huge array is initialized to store all internal IP addresses that should work without the proxy. Somehow it seems that this allocated memory will not be freed after the script ran. If I null the array myself before the appropriate proxy is returned everything works as intended.

Maybe it is still worth looking into this issue, since I am not sure why the browser is not freeing up this memory itself?

Our PAC file is huge too (33 KB approx 800 lines), the same behaviour, even when checked system proxy usage in options.

Flags: needinfo?(milan.kardos2)

Interesting! So it looks like a memory leak or not aggressive enough garbage collection when we are done with processing the PAC script on the parent process.

Luke, do you have any ideas how to diagnose this further or who to ask?

Leaving as a Networking issue for now.

Flags: needinfo?(luke)

Hmm, maybe the GC options for the PAC's JSRuntime are not set correctly. Jon do you have any ideas?

Flags: needinfo?(luke) → needinfo?(jcoppeard)

The PAC runtime uses a default heap size of 4 MB, you could try setting network.proxy.autoconfig_extra_jscontext_heap_size to some big value...

I set mentioned setting to 65535. Not sure if it is correct value, but now for 3 hrs no issue.
Is this heap visible via some telemetry? Found only MEMORY_JS_GC_HEAP ...

Blocks: 1366932

after 6 hrs i need to reload a PAC ...

after setting the mentioned preference to 68157440 it is working fine, no need of PAC reload whole day ...

fyi, with preference network.proxy.autoconfig_extra_jscontext_heap_size set to 68157440 i dont need anymore to reload the PAC file.

(In reply to milan.kardos2 from comment #20)

fyi, with preference network.proxy.autoconfig_extra_jscontext_heap_size set to 68157440 i dont need anymore to reload the PAC file.

tested on latest nightly builds

(In reply to milan.kardos2 from comment #17)

I set mentioned setting to 65535. Not sure if it is correct value, but now for 3 hrs no issue.

(In reply to milan.kardos2 from comment #20)

fyi, with preference network.proxy.autoconfig_extra_jscontext_heap_size set to 68157440 i dont need anymore to reload the PAC file.

That makes sense - the value is in bytes so 65535 gives you only 64 KB extra but with 68157440 you get 65 MB which is significant.

I'd suggest increasing from 4 MB to 64-128 MB or so. The runtime has self-hosted code too so it's expected this got worse over time.

Thanks Jan for answering this.

Flags: needinfo?(jcoppeard)
Assignee: nobody → jdemooij
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

DefaultHeapMaxBytes is currently 32 MB so it should give us a bit more breathing
room.

Whiteboard: [necko-triaged]
Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/151d38734b7f
Use JS::DefaultHeapMaxBytes instead of 4 MB for PAC runtime. r=jonco,mayhemer

Comment on attachment 9086970 [details]
Bug 1547977 - Use JS::DefaultHeapMaxBytes instead of 4 MB for PAC runtime. r?jonco!,mayhemer!

Beta/Release Uplift Approval Request

  • User impact if declined: Problems when using JS files for proxy configuration (PAC).
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: No
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): This just increases the maximum GC heap size for the PAC thread from 4 MB to 32 MB so I think it's worth taking on beta and esr68.
  • String changes made/needed: None
Attachment #9086970 - Flags: approval-mozilla-esr68?
Attachment #9086970 - Flags: approval-mozilla-beta?

Comment on attachment 9086970 [details]
Bug 1547977 - Use JS::DefaultHeapMaxBytes instead of 4 MB for PAC runtime. r?jonco!,mayhemer!

bigger heap for proxy config, approved for 69.0b16 and 68.1esr

Attachment #9086970 - Flags: approval-mozilla-esr68?
Attachment #9086970 - Flags: approval-mozilla-esr68+
Attachment #9086970 - Flags: approval-mozilla-beta?
Attachment #9086970 - Flags: approval-mozilla-beta+
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: