Nginx returns "502 Bad Gateway" after 36-48 hours
Moskus opened this issue ยท 9 comments
If I leave grocy-desktop running (as you would), with external access enabled (at least), I will always get a "502 Bad Gateway" error from nginx. I first figured it had something to do with my reverse proxy setup, but it also happens with that disabled.
A stupid fix is to schedule this .bat-file:
@echo off
echo Terminating Grocy...
taskkill /im grocy-desktop.exe
timeout /t 5
start /min "" C:\Users\YOUR_USER_NAME\AppData\Local\grocy-desktop\grocy-desktop.exe
... but I would rather that grocy-desktop didn't stop working. ๐
502 Bad Gateway
means that the upstream server is not responding, grocy-desktop itself also uses nginx as the frontend webserver and upstreams requests to PHP via FastCGI.
So most probably the PHP FastCGI process(es) died, however, please check the logs (Help/Debug/Show PHP runtime output) to see what happened.
Yes, I would, but the log windows are blank... :(
Then it's hard to say what goes wrong...
Although this should of course not happen, another sign that grocy-desktop is not the ideal server solution... ;D
Where are the log files located? I'm sure I can find the actual files somewhere.
Yes, this is not ideal, but running grocy natively on Windows turns out to be a surprisingly amount of work... I'm thinking about spinning up a VM for grocy alone, but that seems overkill. ;)
There are no log files, what's (normally) visible in the mentioned window is just stdout
and stderr
of the (php.exe) process, code ref:
grocy-desktop/grocy-desktop/Management/PhpManager.cs
Lines 62 to 63 in 793fb10
grocy-desktop/grocy-desktop/Management/PhpManager.cs
Lines 90 to 96 in 793fb10
grocy-desktop/grocy-desktop/Management/PhpManager.cs
Lines 85 to 88 in 793fb10
grocy-desktop/grocy-desktop/FrmMain.cs
Lines 265 to 279 in 793fb10
I also use Windows for clients/workstations and some servers, but most (PHP) things just run more efficiently on Linux, but Windows also has a webserver (IIS) which can also host PHP and it's not really hard to set it up...
I had one idea for this:
Maybe the PHP FastCGI process get killed after x requests (don't know what the default value is), I now disabled this by setting the environment variable PHP_FCGI_MAX_REQUESTS
to 0
- maybe that helps with this.
That's included in the v1.8.0 release, already ready here, the Microsoft Store release usually takes a couple of days due to verification.
This is great, I'll try that! :)
I'm calling it fixed. Grocy-desktop has been running without issues for a week. ๐
Cool, thanks for the feedback. ๐