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 ¯\_(ツ)_/¯

so with me happens almost every 2 weeks. I become aware of 502 Nginx errors.

alone Zammad-web-1 (Puma) restart does not help. but I have to delete .pid before.

I could not find any context and other errors wiese this occurs.

is there meanwhile an explanation or Fix for it ? it is unsightly that the server is suddenly not accessible.

I only see this particular pid issue if a process is dying very violently.
If it happens every two weeks you may want to ensure that your machine has enough memory and doesn’t practise “OOM” killing sprees.

We have tons of instances, source and package based that are running for weeks without issues.

The problem no longer occurs since zammad 5.1.

That wasn’t a memory problem, I usually test on different test machines.