Nginx 502. Zammad not working. Solved. Documenting here

Running Zammad (3.4 and earlier) on Ubuntu 18.04.
For some at first inexplicable reason Nginx only said 502 gateway error.

systemctl status zammad
systemctl status zammad-web
systemctl status zammad-worker
systemctl status zammad-websocket

These were all green.

Restarting zammad gave indication everything was allright.
No mention of something special in the /opt/zammad/log/production.log
Checking netstat -tanp | grep 3000 revealed nothing listening on port 3000.
Checking syslog said:
Aug 3 09:42:24 zammad zammad-web-1.service[9809]: A server is already running. Check /opt/zammad/tmp/pids/server.pid.

Turns out there was a stale PID file /opt/zammad/tmp/pids/server.pid.
(This happened because for the first time in 20 years I actually had kernel panics with kernel 5.4.0-40 on Ubuntu 20.04)
After removing the file and a restart everything was nicely working again.

1 Like

I have the same problem but it’s repeated every day (I suppose there is a daily scheduled restart of zammad-web-1.service). File and tmp folder permissions are ok. Where to find the problem? When I delete PID file and restart the service everything works fine.

[update]
I run ‘watch’ on the folder with PID and restarted the service manually and … zammad has deleted the PID file. The problem exists only on scheduled restarts.

I’m out of ideas ¯\_(ツ)_/¯