Closed Bug 1250776 Opened 4 years ago Closed 4 years ago

Use System Proxy Setting not working with a PAC, which the PAC file come from shadowsocks.

Categories

(Core :: Networking, defect)

44 Branch
x86_64
Windows 8.1
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: gang.zhuo, Assigned: xeonchen)

Details

(Whiteboard: [necko-active])

Attachments

(7 files)

User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Steps to reproduce:


The PAC file come form shadowsocks. (https://github.com/shadowsocks/shadowsocks-windows/tree/master)

The PAC file host by IIS 7. 

Step:
1.	Open Firefox, and change the proxy setting to use system proxy settings, close the Firefox.
 
2.	Change the system proxy settings to http://172.165.1.5:8080/pac.txt?v=1
 
3.	Open the Firefox, and open the https://www.google.com/?gws_rd=ssl. The Proxy not work.
 
See attachment for details and screenshots.



Actual results:

Cannot open google site through a proxy


Expected results:

Open google site through a proxy
Attached image Firefox Version.jpg
Component: Untriaged → Networking
Product: Firefox → Core
OS: Unspecified → Windows 8.1
Hardware: Unspecified → x86_64
Do you know if it used to work with some previous versions of Firefox?
Flags: needinfo?(gang.zhuo)
People chenshaoju reported that it work on version 42, and renziyao reported that it is not work on version 43, see https://github.com/shadowsocks/shadowsocks-windows/issues/439#issuecomment-181919392. On my test, it work when i reduce the rules (the size of PAC file <= 112KB).
Flags: needinfo?(gang.zhuo)
Attached file work.pac.txt
Attached file not_work.pac.txt
There are two new attachments: work.pac.txt and not_work.pac.txt. Work when using work.pac.txt, not work when use not_work.pac.txt. Difference of two files:

--- work.pac.txt        2016-02-23 22:18:56.491027600 -0500
+++ not_work.pac.txt    2016-02-24 06:53:04.903420600 -0500
@@ -4144,7 +4144,7 @@
   "||yesasia.com.hk"
 ];

-/*
+/*AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
 * This file is part of Adblock Plus <http://adblockplus.org/>,
 * Copyright (C) 2006-2014 Eyeo GmbH
 *
Whiteboard: [necko-backlog]
I have the same problem all the time.
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0
 error info:
PAC Execution Error: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create []

PAC Execution Error: uncaught exception: out of memory []

PAC file failed to install from http://127.0.0.1:1080/pac?t=201604061314295770
Assignee: nobody → xeonchen
I currently cannot reproduce this issue based on the discussion on [1] and [2].

[1] https://github.com/shadowsocks/shadowsocks-windows/issues/439 (Simplified Chinese)
[2] https://github.com/shadowsocks/shadowsocks-windows/issues/487 (Simplified Chinese)
Attached file pac.txt
STR:

1. open browser console
2. setup auto proxy configuration to the attached file (or reload)
3. see following error message

PAC Execution Error: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create []
PAC Execution Error: uncaught exception: out of memory []
PAC file failed to install from http://host/pac.txt
I encountered this issue for many days , it really cost me lot of time to debug..
Version 46.0
(In reply to ElvisWang from comment #10)
> I encountered this issue for many days , it really cost me lot of time to
> debug..
> Version 46.0

@ElvisWang, how big is your pac file?
Attached file pac-ElvisWang
pac-ElvisWang
(In reply to Gary Chen [:xeonchen] from comment #11)
> (In reply to ElvisWang from comment #10)
> > I encountered this issue for many days , it really cost me lot of time to
> > debug..
> > Version 46.0
> 
> @ElvisWang, how big is your pac file?

My pac is 125KB , attached as "pac-ElvisWang" to this bug.
(In reply to ElvisWang from comment #13)
> (In reply to Gary Chen [:xeonchen] from comment #11)
> > (In reply to ElvisWang from comment #10)
> > > I encountered this issue for many days , it really cost me lot of time to
> > > debug..
> > > Version 46.0
> > 
> > @ElvisWang, how big is your pac file?
> 
> My pac is 125KB , attached as "pac-ElvisWang" to this bug.

But , however , i don't think it is relates to the size of the pac file . 

just reduce the size by delete many items from the array "rules" , just left few items , but firefox still can not phase the pac file .
I think you should close the firefox, then change you pac file, then open a firefox. In this case, big pac not work, but small pac file work. In my test, just delete some comments, you can download my pac files, and do compare.
See comment 6. I think it's cause by small buffer, maybe.
(In reply to Gang Zhuo from comment #16)
> See comment 6. I think it's cause by small buffer, maybe.

Unfortunately  , the work pac provided by Gang Zhou still doesn't work in my test . 
got the same error on console :

PAC Execution Error: mutating the [[Prototype]] of an object will cause your code to run very slowly; instead create the object with the correct initial [[Prototype]] value using Object.create []
PAC Execution Error: uncaught exception: out of memory []
PAC file failed to install from file:///F://work.pac.txt

version 46.0
(In reply to ElvisWang from comment #17)
> (In reply to Gang Zhuo from comment #16)
> > See comment 6. I think it's cause by small buffer, maybe.
> 
> Unfortunately  , the work pac provided by Gang Zhou still doesn't work in my
> test . 
> got the same error on console :
> 
> PAC Execution Error: mutating the [[Prototype]] of an object will cause your
> code to run very slowly; instead create the object with the correct initial
> [[Prototype]] value using Object.create []
> PAC Execution Error: uncaught exception: out of memory []
> PAC file failed to install from file:///F://work.pac.txt
> 
> version 46.0

Additional information :

My Firefox is an original English version which was downloaded from mozilla.org  , but not firefox.com.cn

Not sure whether they different code branch , just for your information .
The data in the PAC file is too big, and OOM is reported in [1].
If I increase the run-time heap size for JavaScript VM defined in [2] to |2<<21|, the script will be loaded successfully.

@bagder, does the original heap size 2KiB have special meaning or is it possible to increase it?

[1] https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/js/src/gc/Allocator.cpp#263
[2] https://dxr.mozilla.org/mozilla-central/rev/fc15477ce628599519cb0055f52cc195d640dc94/netwerk/base/ProxyAutoConfig.cpp#619
Flags: needinfo?(daniel)
(In reply to Gary Chen [:xeonchen] from comment #19)
> @bagder, does the original heap size 2KiB have special meaning or is it

Sorry for typo... it's 2MiB.
It seems this has been the size all since :mcmanus brought the code in this commit from 2012 for bug 769764: https://github.com/mozilla/gecko-dev/commit/d70af841f6eddc89a5789

Patrick, do you recall any specific details to why the size was picked or if there's anything that prevents us from just bumping this to 4MB?

Was there a particular reason to state the size as 2 << 20? It doesn't make it immediately obvious to me as my in-brain bitshifting logic is a bit on the slowish side! =)

The error reporting when running into this problem is far from ideal too...
Flags: needinfo?(daniel) → needinfo?(mcmanus)
you can make it 4mb
Flags: needinfo?(mcmanus)
Whiteboard: [necko-backlog] → [necko-active]
Comment on attachment 8747039 [details]
MozReview Request: Bug 1250776 - increase JavaScript runtime heap size to 4 MB; r?bagder

https://reviewboard.mozilla.org/r/49695/#review46683

bonus points for comment! =)
Attachment #8747039 - Flags: review?(daniel) → review+
Whiteboard: [necko-active]
We are marking bugs as [necko-active] if some one is working on them - for an easier management of bugs :)
Whiteboard: [necko-active]
https://hg.mozilla.org/mozilla-central/rev/128ec8347adf
Status: UNCONFIRMED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
I still experience this with a very large PAC file that includes a complete list of IP addresses blocked in Russia:

https://relay.abbradar.moe/antizapret-pac.js

I could have evaded object creation in runtime and just make the whole object a constant but then it won't fit into Chromium's [[1MB file size limit|https://bugs.chromium.org/p/chromium/issues/detail?id=678022]]. Either way I've tried this too and it also doesn't fit into current heap size.
I managed to mitigate this problem by using a hash clustered by first two bytes of an IP address.
You need to log in before you can comment on or make changes to this bug.