问题
As highlighted in multiple questions/asnwers before, namely this and this I have configured my WSGISocketPrefix
to be /etc/httpd/run/wsgi
/etc/httpd/run
directory has permission root:apache and the sock file created has apache:root permission.
The issue I am facing is that apache is always trying to connect to the sock which is one less than what it should be looking for. Example the sock is /var/run/httpd/wsgi.1769.1.1.sock
but apache looks for /var/run/httpd/wsgi.1769.0.1.sock
There are no permission issues AFAIK, the problem is with the WSGI sock number apache is looking up. How can I overcome this issue? Why is there a mismatch between sock-version
between wsgi and apache?
Exact log line: (2)No such file or directory: [client A.B.C.D:57798] mod_wsgi (pid=1549): Unable to conn
ect to WSGI daemon process 'wsgi' on '/etc/httpd/run/wsgi.1144.0.1.sock' after multiple attempts.
回答1:
Most likely because you have done an Apache graceful restart and there was a long lived client connection using keep alive which has kept the Apache child worker process running, with it trying to handle further requests on same connection. That process will only try and connect to the daemon process group as it existed when that process was created, but the restart meant the daemon process group got restarted. It cannot switch to using new instance of daemon process group for security reasons as configuration changes meant that perhaps it shouldn't be doing that. To allow it could cause security breach.
There is no simple way to mitigate it except to not use graceful restarts, or turn of keep alive for client connections.
How often are you doing graceful restarts? How heavily are you dependent on keep alive connections against your dynamic Python applications?
来源:https://stackoverflow.com/questions/37799282/unable-to-connect-to-wsgi-daemon-process-wsgi