Actually, let’s clarify first things first: there is no HTTP status code 0 (zero). The problem is that the nginx worker process dies while processing the request and therefore the connection interrupts which results in an error without any response data.
nginx Series Overview
- How To Install the Newest Version of Nginx on Ubuntu
- How to Run GitLab with Self-Signed SSL Certificate
- How to Fix Reponse Status 0 (Worker Process Exited on Signal 11)
- Redirect Only Root URL Path
- Remove an App/Domain from Sites-Enabled
- How to Serve a Static HTML Page
- Is Running but Not Serving Sites
- How to Fix Unknown "connection_upgrade" Variable
Problem
We had this issue within various situations:
- Github Webhooks: the webhook request wouldn’t finish successfully and the response code was always
0
- Piwik: we couldn’t open the Piwik web dashboard within Safari browser and also we couldn’t add connection details on Android. Requests in both scenarios resulted in an erroneous response with
status 0
Since we couldn’t find any application errors within the Strider and Piwik logs, the problem needed to be on the layer below: nginx.
We checked nginx’s error log file and finally there was a lead to follow.
This is the default nginx error log file location on Ubuntu: /var/log/nginx/error.log
Error log file entries:
2015/10/16 09:37:34 [alert] 7955#0: worker process 9835 exited on signal 11 (core dumped)
2015/10/16 09:37:36 [alert] 7955#0: worker process 9853 exited on signal 11 (core dumped)
2015/10/16 09:37:36 [alert] 7955#0: worker process 9855 exited on signal 11 (core dumped)
2015/10/16 09:42:34 [alert] 7955#0: worker process 9857 exited on signal 11 (core dumped)
If you’re interested, we use nginx version 1.8.0
.
Solution
To fix the problem, edit nginx’s configuration and add the following line within the http
block.
The default location of nginx’s configuration file on Ubuntu is /etc/nginx/nginx.conf
http {
…
ssl_session_cache shared:SSL:10m;
…
}
Nginx uses multiple worker processes to handle incoming requests. The ssl_session_cache shared:SSL:10m
causes nginx to share the session information between all worker processes. From now on, every worker has the session information available and won’t stop executing the request due to missing request data.
Don’t forget to restart the nginx service.
sudo service nginx restart
That’s it. Your requests will flow through nginx to your apps and vice versa without hiccups!