Join 1M+ other developers and:
- Get help and share knowledge in Q&A
- Subscribe to topics of interest
- Get courses & tools that help you grow as a developer or small business owner
502 Bad Gateway on long running function
Hey so for quite some time I have been having issues on my website
We have a feature where you can import data from another website and this function usually takes some time the first time you run it, upwards to 3-4 minutes due to all the data coming in and the calculations needed to be made to correctly display it all.
But the problem is that when someone imports and their trade log (the data we read in) is really big, in the middle of it, maybe 60-75 seconds in it returns a 502 bad gateway.
Now I’m not sure how to fix this, I am running Laravel Forge and Laravel as the framework obviously.
In both PHP CLI and PHP FPM I set
maxinputtime = 3600
maxexecutiontime = 3600
ignoreuserabort = On
But neither of that fixed it.
So I went to NGINX and set a bunch of variables to super high numbers but nothing fixed that either.
What can I do?
Here is what my nginx error log says:
2017/08/18 11:29:37 [error] 5104#5104: *552840 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 126.96.36.199, server: altpocket.io, request: “GET /test1231 HTTP/1.1”, upstream: “fastcgi://unix:/var/run/php/php7.1-fpm.sock:”, host: “altpocket.io”
Here is PHP 7.1 FPM Log:
[18-Aug-2017 11:29:37] WARNING: [pool www] child 1326, script ’/home/forge/Altpocket.io/public/index.php’ (request: “GET /index.php”) execution timed out (78.546796 sec), terminating
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.×