Open Bug 1346183 Opened 7 years ago Updated 2 months ago

pac proxy working intermittently after firefox update to 52

Categories

(Core :: Networking: Proxy, defect, P3)

52 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: u534289, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [necko-triaged])

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170307144106

Steps to reproduce:

use a pac proxy file in firefox setting.
load a website that needs a proxy from that pac file.
refresh that websites a couple of times.



Actual results:

the proxy was not always loaded correctly and sometimes the website would connect directly to internet


Expected results:

the website should always used the proxy provided with pac proxy.
additional info.
I am from Iran so many websites here are blocked and I use a pac proxy file that is configured to use a proxy to circumvent the internet filtering for some websites, but uses direct connection for all others.

after updating to firefox 52 I saw many times that the websites that are blocked are not always loaded through proxy. I narrowed the issue to firefox update and the addon foxyproxy. if I downgrade to firefox 51.0.1 the bug goes away.

anyway I updated to 52 and tried to find the extension responsible and found out that if I disable the foxyproxy the bug would disappear(At least in that step of process).

but after some use I saw that the problem is that the pac proxy is not always used and refreshing a filtered website would sometimes load it directly and it would show the blocked massage page from isp.

this doesn't always happen so it is a weird behavior.
my pac file is loaded from lan network.

when I downgrade to firefox 51 the bug goes away entirely(even with foxyproxy installed)
this is the error that I think is relavent in logs.
"PAC Execution Error: uncaught exception: out of memory []"
Can you check the issue using Firefox native PAC configuration, without foxyproxy add-on, it may happens?
Flags: needinfo?(rezad1393)
In addition, if you could find the regression range, that would help.
http://mozilla.github.io/mozregression/
(In reply to YF (Yang) from comment #3)
> Can you check the issue using Firefox native PAC configuration, without
> foxyproxy add-on, it may happens?

what I said about foxyproxy was just me seeing the bug for the first time.
I have disabled the addon as I said.
but still the bug occurs sometimes.
maybe it is just my pac that causes this but downgrading to firefox 51 fixes it.
Bug 1250776 fixed a similar bug in Fx49 and later. Just as a reference.
Component: Untriaged → Networking
Product: Firefox → Core
Summary: pac proxy working intermittently after firefox update → pac proxy working intermittently after firefox update to 52
for those that are interested in checking this, when I downgrade to firefox 51 then issue seems to go away.(to the best of my knowlenge)
Whiteboard: [necko-next]
Whiteboard: [necko-next] → [necko-next][proxy]
According to comment 2, it looks OOM happened(maybe related to size of PAC file?).  Gary, you have fixed 1250776 which seems related to this one, do you have any comments?
Flags: needinfo?(xeonchen)
If the issue can't be reproduced on v51, the PAC file size would not matter since the VM stack size doesn't changed since v49.

Is there any other message around the OOM report?
Would you try to simplify (e.g. delete some rules) the PAC file and see if it works?

And just like what YF mentioned in comment 4, it is really helpful if you can find the regression range.
Flags: needinfo?(xeonchen)
I am not really a developer so I can't "find the regression range" as you said.
what I know are these:

1-this is not foxyproxy related. but foxyproxy has some other bugs that appear in firefox 53( for example when using quickadd from foxyproxy it says it can not get the url of page)
2-I can see in browser console that it says this :"PAC Execution Error: uncaught exception: out of memory []"
and when this happens it seems that firefox doesn't use that pac file and some connections "escape" the pac proxy and connect directly.
3-this happens after firefox 51  starting from firefox 52.

this happens a lot and has made internet browsing really bad for me as in my country a lot of the websites I use are blocked but the access to outside the country is slow so I have to use selective proxy (as in foxyproxy or a pac file) . 
the pac file works for other apps and even on my android tablet.
Flags: needinfo?(rezad1393)
the pac size is 54KB if that is important.
(In reply to rezad from comment #10)
> I am not really a developer so I can't "find the regression range" as you
> said.

mozregression is not for developers, it's an utility to check the exact date the issue happened.
It's worthy to give it a try by referring the quick start page:

https://mozilla.github.io/mozregression/quickstart.html

That would be very helpful.

> what I know are these:
> 
> 1-this is not foxyproxy related. but foxyproxy has some other bugs that
> appear in firefox 53( for example when using quickadd from foxyproxy it says
> it can not get the url of page)

If it is not foxyproxy related, could you create an example of PAC and reproduce it
without installing foxyproxy?
It's much easier to solve such kind of issues if developers get a chance to reproduce it.

> 2-I can see in browser console that it says this :"PAC Execution Error:
> uncaught exception: out of memory []"
> and when this happens it seems that firefox doesn't use that pac file and
> some connections "escape" the pac proxy and connect directly.

The default behavior is to connect directly when there's something wrong in the PAC execution.
So that's why we're trying to figure out what the problem is.

> 3-this happens after firefox 51  starting from firefox 52.

There are millions lines of code changed between v51 and v52, so it's extremely difficult to check what went
wrong during those two versions.
Even thought a daily range is still large, but it can significantly reduce the time to check the modifications
related to the PAC stuff.
I can't say the problem will definitely be resolved, at least it is a good start. 

> this happens a lot and has made internet browsing really bad for me as in my
> country a lot of the websites I use are blocked but the access to outside
> the country is slow so I have to use selective proxy (as in foxyproxy or a
> pac file) . 
> the pac file works for other apps and even on my android tablet.

I've created a custom build on [1][2][3], which the heap size has been increased to 16 MB (4-times than default).
Would you help to install and test?

[1] Mac/Win32/Win64: https://mzl.la/2qNXq30
[2] Linux x86: http://bit.ly/2rNcwFd
[3] Linux x64: http://bit.ly/2rv9zwO
Flags: needinfo?(rezad1393)
I cant reproduce it always because it doesn't always happen. and if the pac error happens on a connection to some domain that is also connected directly in pac file then I wont catch the error,as that would be the same as pac proxy working correctly.

and if it is not clear I have disabled foxyproxy for a long time now cause it doesn't work correctly in 53.

so the issue is just the pac proxy.

because the bug isn't a always present bug, I cant use the mozregression and download a lot of version and check them all.
I use Firefox daily a lot with a complete profile and cant test the nightlies as stated in mozregression.

sorry if that is not helpful.
Flags: needinfo?(rezad1393)
using your x64 build I got some bugs (like some menus disappearing) but...... this bug seems to be gone.
I don't see the bug message in the browser console.
I tested with firefox beta and nightly and the message was there at the start of firefox running.

thanks for the build.
can you give me the patch file? I am not  pro but I will try to apply it to firefox 53.

the weird thing is that I think the message was also shown in firefox 51 but it didn't hinder web browsing.
i think my bug is like this bug https://bugzilla.mozilla.org/show_bug.cgi?id=1250776
I increased the heap size (I think,I am not a programmer) in source of firefox 53 and recompiled and it seams to have fixed this

like this:
--- a/netwerk/base/ProxyAutoConfig.cpp
+++ b/netwerk/base/ProxyAutoConfig.cpp
600c600
<   static const unsigned sContextHeapSize = 4 << 20; // 4 MB
---
>   static const unsigned sContextHeapSize = 16 << 20; // 16 MB
I'm seeing this issue as well.  For those who want to work around it, it looks like you can only have about two rules in the .pac file.  E.g.

function FindProxyForUrl(uri, host) {
    if (...) {
        return ...
    }
    if (...) {
        return ...
    }
    return "DIRECT";
}

At least this is what's currently working for me.
(In reply to sybrandy from comment #17)
> I'm seeing this issue as well.  For those who want to work around it, it
> looks like you can only have about two rules in the .pac file.  E.g.
> 
> function FindProxyForUrl(uri, host) {
>     if (...) {
>         return ...
>     }
>     if (...) {
>         return ...
>     }
>     return "DIRECT";
> }
> 
> At least this is what's currently working for me.

Hi sybrandy,

Are you willing to provide your pac file?
If you don't feel like to make it public, maybe an email is better?
Flags: needinfo?(sybrandy)
Here you go, but there really isn't much more to it.  (Sanitized the hostnames)

function FindProxyForUrl(uri, host)) {
    if (dnsDomainIs(host, "<domain1>") {
        return "SOCKS5 127.0.0.1:9102; DIRECT";
    }
    if (dnsDomainIs(host, "<domain2>")) {
        return "SOCKS5 127.0.0.1:9101; DIRECT";
    }
    return "DIRECT";
}

Ports are just random values that I picked.  I'm using SSH to tunnel.  Also, there used to be more entries, but I removed them since they weren't being used any more anyway.
Flags: needinfo?(sybrandy)
(In reply to sybrandy from comment #19)
> Here you go, but there really isn't much more to it.  (Sanitized the
> hostnames)
> 
> function FindProxyForUrl(uri, host)) {
>     if (dnsDomainIs(host, "<domain1>") {
>         return "SOCKS5 127.0.0.1:9102; DIRECT";
>     }
>     if (dnsDomainIs(host, "<domain2>")) {
>         return "SOCKS5 127.0.0.1:9101; DIRECT";
>     }
>     return "DIRECT";
> }
> 
> Ports are just random values that I picked.  I'm using SSH to tunnel.  Also,
> there used to be more entries, but I removed them since they weren't being
> used any more anyway.

So if you add one more rule, for example:

function FindProxyForUrl(uri, host)) {
    if (dnsDomainIs(host, "<domain1>") {
        return "SOCKS5 127.0.0.1:9102; DIRECT";
    }
    if (dnsDomainIs(host, "<domain2>")) {
        return "SOCKS5 127.0.0.1:9101; DIRECT";
    }
    if (dnsDomainIs(host, "<domain3>")) {
        return "SOCKS5 127.0.0.1:9100; DIRECT";
    }
    return "DIRECT";
}

and that script is not going to work?

I'll try this on my side, thanks for your comment.
FYI: bug 1366932 is landed, so if you're using Firefox Nightly, (probably tomorrow) you will able to use "network.proxy.autoconfig_extra_jscontext_heap_size" (in bytes) in about:config to increase you heap size.
Bulk change to priority: https://bugzilla.mozilla.org/show_bug.cgi?id=1399258
Priority: -- → P2
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3
Severity: normal → S3

Moving bug to Core/Networking: Proxy.

Component: Networking → Networking: Proxy
Blocks: necko-proxy
Whiteboard: [necko-next][proxy] → [necko-triaged]
You need to log in before you can comment on or make changes to this bug.