nginxinc/nginx-amplify-agent

Start after reboot failed but manual start is ok

knutov opened this issue · 3 comments

After rebooting server with ubuntu 20.04 amplify-agent is not starting with following log:

-- Reboot --
Oct 16 16:55:56 d1 systemd[1]: Starting NGINX Amplify Agent...
Oct 16 16:56:04 d1 amplify-agent[1954]: Something failed:
Oct 16 16:56:04 d1 amplify-agent[1954]: Traceback (most recent call last):
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/amplify/agent/common/util/configreader.py", line 123, in test
Oct 16 16:56:04 d1 amplify-agent[1954]:     context.http_client.post('agent/', {})
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/amplify/agent/common/util/http.py", line 128, in post
Oct 16 16:56:04 d1 amplify-agent[1954]:     return self.make_request(url, 'post', data=data, timeout=timeout, json=json)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/amplify/agent/common/util/http.py", line 110, in make_request
Oct 16 16:56:04 d1 amplify-agent[1954]:     raise e
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/amplify/agent/common/util/http.py", line 94, in make_request
Oct 16 16:56:04 d1 amplify-agent[1954]:     r = self.session.post(
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/requests/sessions.py", line 581, in post
Oct 16 16:56:04 d1 amplify-agent[1954]:     return self.request('POST', url, data=data, json=json, **kwargs)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
Oct 16 16:56:04 d1 amplify-agent[1954]:     resp = self.send(prep, **send_kwargs)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
Oct 16 16:56:04 d1 amplify-agent[1954]:     r = adapter.send(request, **kwargs)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/requests/adapters.py", line 439, in send
Oct 16 16:56:04 d1 amplify-agent[1954]:     resp = conn.urlopen(
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 665, in urlopen
Oct 16 16:56:04 d1 amplify-agent[1954]:     httplib_response = self._make_request(
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 376, in _make_request
Oct 16 16:56:04 d1 amplify-agent[1954]:     self._validate_conn(conn)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/connectionpool.py", line 996, in _validate_conn
Oct 16 16:56:04 d1 amplify-agent[1954]:     conn.connect()
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 314, in connect
Oct 16 16:56:04 d1 amplify-agent[1954]:     conn = self._new_conn()
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/connection.py", line 159, in _new_conn
Oct 16 16:56:04 d1 amplify-agent[1954]:     conn = connection.create_connection(
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/urllib3/util/connection.py", line 61, in create_connection
Oct 16 16:56:04 d1 amplify-agent[1954]:     for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/_socketcommon.py", line 212, in getaddrinfo
Oct 16 16:56:04 d1 amplify-agent[1954]:     addrlist = get_hub().resolver.getaddrinfo(host, port, family, type, proto, flags)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/resolver/thread.py", line 65, in getaddrinfo
Oct 16 16:56:04 d1 amplify-agent[1954]:     return self.pool.apply(_socket.getaddrinfo, args, kwargs)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/pool.py", line 159, in apply
Oct 16 16:56:04 d1 amplify-agent[1954]:     return self.spawn(func, *args, **kwds).get()
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "src/gevent/event.py", line 268, in gevent._event.AsyncResult.get
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "src/gevent/event.py", line 296, in gevent._event.AsyncResult.get
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "src/gevent/event.py", line 286, in gevent._event.AsyncResult.get
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "src/gevent/event.py", line 266, in gevent._event.AsyncResult._raise_exception
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "src/gevent/event.py", line 211, in gevent._event.AsyncResult.exc_info.__get__
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 371, in g
Oct 16 16:56:04 d1 amplify-agent[1954]:     return f(a)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 432, in load_traceback
Oct 16 16:56:04 d1 amplify-agent[1954]:     return loads(s)
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 337, in unpickle_traceback
Oct 16 16:56:04 d1 amplify-agent[1954]:     return ret.as_traceback()
Oct 16 16:56:04 d1 amplify-agent[1954]:   File "/usr/lib/python3/dist-packages/gevent/_tblib.py", line 202, in as_traceback
Oct 16 16:56:04 d1 amplify-agent[1954]:     code = CodeType(
Oct 16 16:56:04 d1 amplify-agent[1954]: TypeError: an integer is required (got type bytes)
Oct 16 16:56:04 d1 systemd[1]: amplify-agent.service: Control process exited, code=exited, status=1/FAILURE
Oct 16 16:56:04 d1 systemd[1]: amplify-agent.service: Failed with result 'exit-code'.
Oct 16 16:56:04 d1 systemd[1]: Failed to start NGINX Amplify Agent.

After manually start with systemctl start amplify-agent agent is working:

# systemctl status amplify-agent
● amplify-agent.service - NGINX Amplify Agent
     Loaded: loaded (/lib/systemd/system/amplify-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-10-16 17:43:59 MSK; 16min ago
       Docs: https://amplify.nginx.com/docs/
    Process: 521159 ExecStart=/etc/init.d/amplify-agent start (code=exited, status=0/SUCCESS)
   Main PID: 521200 (amplify-agent)
      Tasks: 2 (limit: 76906)
     Memory: 38.7M
     CGroup: /system.slice/amplify-agent.service
             └─521200 amplify-agent

Oct 16 17:43:58 d1 systemd[1]: Starting NGINX Amplify Agent...
Oct 16 17:43:59 d1 systemd[1]: amplify-agent.service: Can't open PID file /run/amplify-agent/amplify-agent.pid (yet?) after start: Operation not permitted
Oct 16 17:43:59 d1 systemd[1]: Started NGINX Amplify Agent.

# ls -la  /run/amplify-agent
total 4
drwxr-xr-x  2 nginx root   60 Oct 16 17:43 .
drwxr-xr-x 31 root  root  960 Oct 16 17:51 ..
-rw-r--r--  1 nginx nginx   7 Oct 16 17:43 amplify-agent.pid

Seconding this, I have the same problem on Debian 11, exactly the same.

systemctl status amplify-agent
● amplify-agent.service - NGINX Amplify Agent
     Loaded: loaded (/lib/systemd/system/amplify-agent.service; enabled; vendor preset: enabled)
     Active: failed (Result: timeout) since Fri 2022-12-30 14:20:26 EST; 1 weeks 0 days ago
       Docs: https://amplify.nginx.com/docs/
        CPU: 629ms

Dec 30 14:18:55 ftl-nginx systemd[1]: Starting NGINX Amplify Agent...
Dec 30 14:20:26 ftl-nginx systemd[1]: amplify-agent.service: start operation timed out. Terminating.
Dec 30 14:20:26 ftl-nginx systemd[1]: amplify-agent.service: Failed with result 'timeout'.
Dec 30 14:20:26 ftl-nginx systemd[1]: Failed to start NGINX Amplify Agent.
root@ftl-nginx:/home/sirrush# systemctl start amplify-agent
root@ftl-nginx:/home/sirrush# systemctl status amplify-agent
● amplify-agent.service - NGINX Amplify Agent
     Loaded: loaded (/lib/systemd/system/amplify-agent.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-01-07 12:52:56 EST; 2s ago
       Docs: https://amplify.nginx.com/docs/
    Process: 51499 ExecStart=/etc/init.d/amplify-agent start (code=exited, status=0/SUCCESS)
   Main PID: 51543 (amplify-agent)
      Tasks: 2 (limit: 4629)
     Memory: 33.8M
        CPU: 2.434s
     CGroup: /system.slice/amplify-agent.service
             └─51543 amplify-agent

Jan 07 12:52:52 ftl-nginx systemd[1]: Starting NGINX Amplify Agent...
Jan 07 12:52:54 ftl-nginx systemd[1]: amplify-agent.service: Can't open PID file /run/amplify-agent/amplify-agent.pid (yet?) after start: Operation not permitted
Jan 07 12:52:56 ftl-nginx systemd[1]: Started NGINX Amplify Agent.
root@ftl-nginx:/home/sirrush# ls -ltra /run/amplify-agent
total 4
drwxr-xr-x 24 root     root     740 Jan  7 12:48 ..
-rw-r--r--  1 www-data www-data   6 Jan  7 12:52 amplify-agent.pid
drwxr-xr-x  2 www-data root      60 Jan  7 12:52 .

same problem here:

Nov 29 21:42:01 ibos-baru systemd[1]: Starting NGINX Amplify Agent...
Nov 29 21:42:03 ibos-baru systemd[1]: amplify-agent.service: Can't open PID file /run/amplify-agent/amplify-agent.pid (yet?) after start: Operation not permitted
Nov 29 21:42:04 ibos-baru systemd[1]: Started NGINX Amplify Agent.

Got the same problem, any suggestion?