tkluck / pac4cli

Proxy-auto-discovery for command-line applications
25 stars 9 forks source link

Getting error 'Start request repeated too quickly.' #72

Closed Kalyan-M closed 4 years ago

Kalyan-M commented 4 years ago
sudo service pac4cli status | fold -s 
● pac4cli.service - PAC autoconfigured proxy for use through http_proxy= 
environment variables
   Loaded: loaded (/usr/local/lib/systemd/system/pac4cli.service; disabled; 
vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2020-02-18 19:00:01 IST; 1min 
24s ago
  Process: 6816 ExecStart=/usr/local/bin/pac4cli -p 3128 --systemd --config 
/etc/pac4cli/pac4cli.config --loglevel warn (code=exited, status=1/FAILURE)
 Main PID: 6816 (code=exited, status=1/FAILURE)

Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Failed with result 
'exit-code'.
Feb 18 19:00:01 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for 
use through http_proxy= environment variables.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Service RestartSec=100ms 
expired, scheduling restart.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Scheduled restart job, 
restart counter is at 5.
Feb 18 19:00:01 pop-os systemd[1]: Stopped PAC autoconfigured proxy for use 
through http_proxy= environment variables.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Start request repeated too 
quickly.
Feb 18 19:00:01 pop-os systemd[1]: pac4cli.service: Failed with result 
'exit-code'.
Feb 18 19:00:01 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for 
use through http_proxy= environment variables.
tkluck commented 4 years ago

Thanks for opening a report! The logs are from systemd trying to restart but they don't contain info on why the restart is failing. Could you post the output of journalctl -u pac4cli.service?

Kalyan-M commented 4 years ago

-- Logs begin at Sun 2020-02-16 17:39:28 IST, end at Wed 2020-02-19 11:37:43 IST. -- Feb 18 16:48:22 pop-os systemd[1]: Starting PAC autoconfigured proxy for use through http_proxy= environment variables... Feb 18 16:48:23 pop-os pac4cli[7143]: Traceback (most recent call last): Feb 18 16:48:23 pop-os pac4cli[7143]: File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main Feb 18 16:48:23 pop-os pac4cli[7143]: "__main__", mod_spec) Feb 18 16:48:23 pop-os pac4cli[7143]: File "/usr/lib/python3.7/runpy.py", line 85, in _run_code Feb 18 16:48:23 pop-os pac4cli[7143]: exec(code, run_globals) Feb 18 16:48:23 pop-os pac4cli[7143]: File "/usr/local/lib/python3.7/dist-packages/pac4cli/__main__.py", line 3, in <module> Feb 18 16:48:23 pop-os pac4cli[7143]: from twisted.internet import reactor Feb 18 16:48:23 pop-os pac4cli[7143]: ModuleNotFoundError: No module named 'twisted' Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Main process exited, code=exited, status=1/FAILURE Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Failed with result 'exit-code'. Feb 18 16:48:23 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for use through http_proxy= environment variables. Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart. Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 1. Feb 18 16:48:23 pop-os systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables. Feb 18 16:48:23 pop-os systemd[1]: Starting PAC autoconfigured proxy for use through http_proxy= environment variables... Feb 18 16:48:23 pop-os pac4cli[7159]: Traceback (most recent call last): Feb 18 16:48:23 pop-os pac4cli[7159]: File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main Feb 18 16:48:23 pop-os pac4cli[7159]: "__main__", mod_spec) Feb 18 16:48:23 pop-os pac4cli[7159]: File "/usr/lib/python3.7/runpy.py", line 85, in _run_code Feb 18 16:48:23 pop-os pac4cli[7159]: exec(code, run_globals) Feb 18 16:48:23 pop-os pac4cli[7159]: File "/usr/local/lib/python3.7/dist-packages/pac4cli/__main__.py", line 3, in <module> Feb 18 16:48:23 pop-os pac4cli[7159]: from twisted.internet import reactor Feb 18 16:48:23 pop-os pac4cli[7159]: ModuleNotFoundError: No module named 'twisted' Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Main process exited, code=exited, status=1/FAILURE Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Failed with result 'exit-code'. Feb 18 16:48:23 pop-os systemd[1]: Failed to start PAC autoconfigured proxy for use through http_proxy= environment variables. Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Service RestartSec=100ms expired, scheduling restart. Feb 18 16:48:23 pop-os systemd[1]: pac4cli.service: Scheduled restart job, restart counter is at 2. Feb 18 16:48:23 pop-os systemd[1]: Stopped PAC autoconfigured proxy for use through http_proxy= environment variables. Feb 18 16:48:23 pop-os systemd[1]: Starting PAC autoconfigured proxy for use through http_proxy= environment variables...

Looks like it's not finding twisted. I also tried to run pac4cli manually and it cannot find pacparser. Do I need to install these dependencies manually? pac4cli Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.7/dist-packages/pac4cli/__main__.py", line 9, in <module> import pacparser ModuleNotFoundError: No module named 'pacparser'

Kalyan-M commented 4 years ago

Note that I've successfully run the pip3 install command, and looks like it did contain twisted.

kdehairy commented 4 years ago

Did you do make install?

Kalyan-M commented 4 years ago

yes.

Kalyan-M commented 4 years ago

Okay, so I managed to manually install pacparser using sudo apt install python3-pacparser. Now when I try to manually run pac4cli this is what I'm getting. pac4cli Traceback (most recent call last): File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "/usr/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/local/lib/python3.7/dist-packages/pac4cli/pac4cli.py", line 7, in <module> from . import portforward ImportError: attempted relative import with no known parent package

output from journalctl -u pac4cli.service remains same. Any ideas on what might be going on?

tkluck commented 4 years ago

Stackoverflow suggests that one reason this might happen is if you are running the script as a script instead of as a module (this link here). I'm not sure if that's the case for you because I see _run_module_as_main in your stack trace, but just to double-check: are you running it as

python3 -m pac4cli

which is what should be in the shell script

$ cat `which pac4cli`
#!/bin/sh
/usr/bin/python3 -m pac4cli "$@"

?

tkluck commented 4 years ago

@Kalyan-M how is it going? Did you manage to get it to work?

Kalyan-M commented 4 years ago

I tried to install it again in a fresh install of ubuntu 19.10 and I'm still getting error. Installation:

sudo apt install libsystemd-dev
pip3 install requirements.txt
sudo make install
Mar 04 21:13:15 systemd[1]: Starting PAC autoconfigured proxy for use through http_proxy= environment variables...
Mar 04 21:13:16 pac4cli[2860]: Traceback (most recent call last):
Mar 04 21:13:16 pac4cli[2860]:   File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
Mar 04 21:13:16 pac4cli[2860]:     "__main__", mod_spec)
Mar 04 21:13:16 pac4cli[2860]:   File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
Mar 04 21:13:16 pac4cli[2860]:     exec(code, run_globals)
Mar 04 21:13:16 pac4cli[2860]:   File "/usr/local/lib/python3.7/dist-packages/pac4cli/__main__.py", line 3, in <module>
Mar 04 21:13:16 pac4cli[2860]:     from twisted.internet import reactor
Mar 04 21:13:16 pac4cli[2860]: ModuleNotFoundError: No module named 'twisted'
Mar 04 21:13:16 systemd[1]: pac4cli.service: Main process exited, code=exited, status=1/FAILURE
Mar 04 21:13:16 systemd[1]: pac4cli.service: Failed with result 'exit-code'.
Mar 04 21:13:16 systemd[1]: Failed to start PAC autoconfigured proxy for use through http_proxy= environment variables.

Although, importing twisted and reactor from twisted.internet works from python interactive shell.

By the way, my corporate proxy also requires authentication. Will downloading the pac file, editing the proxy with username:password@proxy.com, and specifying the file location instead of url in the pac4cli.config work?

tkluck commented 4 years ago

Although, importing twisted and reactor from twisted.internet works from python interactive shell.

That's so weird. Can you paste the terminal input/output for what's working as well? And can you try whether make check works?

By the way, my corporate proxy also requires authentication. Will downloading the pac file, editing the proxy with username:password@proxy.com, and specifying the file location instead of url in the pac4cli.config work?

Ayay, no I don't think that's supported at the moment. Let me open an issue for that.

Kalyan-M commented 4 years ago

I finally did

sudo apt install python3-pacparser
sudo apt install python3-twisted
sudo apt install python3-service-identity
sudo apt install python3-txdbus

and downloaded and installed

pac4cli_0.1ubuntu2+git119~ubuntu19.04.1_all.deb
python3-systemd-cython_0.9.15+git37~ubuntu18.04.1_amd64.deb
python-systemd-cython_0.9.15+git37~ubuntu18.04.1_amd64.deb
python3-txdbus_1.0.15~git1+git84~ubuntu19.04.1_all.deb
python-txdbus_1.0.15~git1+git84~ubuntu19.04.1_all.deb

from launchpad and it works fine.

tkluck commented 4 years ago

Happy to hear! I'm closing this issue, then.

If you have time, maybe you can edit the README with a small paragraph that would have helped you so others don't run into the same issue.