carsonyl / pypac

Find and use proxy auto-config (PAC) files with Python and Requests.
https://pypac.readthedocs.io
Apache License 2.0
71 stars 19 forks source link

Make the script validity check optional #71

Closed ZzZombo closed 1 year ago

ZzZombo commented 1 year ago

I just realized the check I uncommented in #68 breaks my application in more ways. For some reason the same PAC script, if subjected to the check, takes exceedingly long time to complete, crippling performance. I suppose it's not the problem in pypac rather in the script, but given it appears it works OK on real URLs, so I'd like to make the validation optional.

carsonyl commented 1 year ago

The slowness is due to a bug in the fix for #68. The result is that although the PAC file executes successfully for IP hosts, it tries to resolve the IP for host false 9 times, each time it's called. I'll revise isInNet() to return False immediately for falsey hostnames, which will avoid this problem.

ZzZombo commented 1 year ago

Hey, thanks for letting me know! I did know something was wrong with the update, just not what exactly! Your reply has saved me from endless hair splitting because my application started to crash out of the blue since then, and even when not, its performance has severely degraded nearly to the point of hanging. I've fixed locally the function you pointed out and so far it's been very well.

ZzZombo commented 1 year ago

Actually, upon further testing, my euphoria was premature. I had to scrap use of this package because it caused crashes in the application under heavy load, w/o any traceable errors. Just silent crashes. W/o the fix it used to crash as well very frequently, seemingly after it stopped to, but it did continue to do so, just at a vastly reduced rate. It's just a guess it's tied to the load on the application, connecting the dots, given it crashed very frequently w/o the fix and crashes way less frequently w/ it applied.

carsonyl commented 1 year ago

That's too bad. I haven't heard of such instability. If you ever come across the cause or a trace, please file an issue.