2017-09-28 5 views
2

webapp가 EC2에 배포되고 다음 오류가 임의로 발생합니다. 하루에 한두 번씩 웹 응용 프로그램을 일정 기간 동안 액세스 할 수 없도록 만듭니다. 잠시 후 자동으로 수정됩니다.해당 파일 또는 디렉토리가 없습니다. mod_wsgi : '/var/run/apache2/wsgi.30303.0.1.sock'의 'web2py'프로세스에 연결할 수 없습니다.

(2)No such file or directory: [client xxx.xx.xx.xxx:xxxxx] mod_wsgi (pid=xxxxx): Unable to connect to WSGI daemon process 'web2py' on '/var/run/apache2/wsgi.30303.0.1.sock'. 

응용 프로그램 스택 web2py mod_wsgi에 아파치

로그 때마다 오류 전에 다른 :

[Thu Sep 28 06:25:01.528334 2017] [mpm_event:notice] [pid 30303:tid 140438078609280] AH00493: SIGUSR1 received. Doing graceful restart 
[Thu Sep 28 06:25:02.318551 2017] [ssl:warn] [pid 30303:tid 140438078609280] AH01906: ip-172-31-0-91.eu-west-1.compute.internal:443:0 server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) 
[Thu Sep 28 06:25:02.318574 2017] [ssl:warn] [pid 30303:tid 140438078609280] AH01909: ip-172-31-0-91.eu-west-1.compute.internal:443:0 server certificate does NOT include an ID which matches the server name 
[Thu Sep 28 06:25:02.318664 2017] [wsgi:warn] [pid 30303:tid 140438078609280] mod_wsgi: Compiled for Python/2.7.11. 
[Thu Sep 28 06:25:02.318669 2017] [wsgi:warn] [pid 30303:tid 140438078609280] mod_wsgi: Runtime using Python/2.7.12. 
[Thu Sep 28 06:25:02.319205 2017] [mpm_event:notice] [pid 30303:tid 140438078609280] AH00489: Apache/2.4.18 (Ubuntu) OpenSSL/1.0.2g mod_wsgi/4.3.0 Python/2.7.12 configured -- resuming normal operations 
[Thu Sep 28 06:25:02.319225 2017] [core:notice] [pid 30303:tid 140438078609280] AH00094: Command line: '/usr/sbin/apache2' 
[Thu Sep 28 06:25:09.327495 2017] [mpm_event:error] [pid 30303:tid 140438078609280] AH00485: scoreboard is full, not at MaxRequestWorkers 
[Thu Sep 28 06:28:39.560285 2017] [mpm_event:error] [pid 30303:tid 140438078609280] AH00485: scoreboard is full, not at MaxRequestWorkers 
[Thu Sep 28 06:45:27.583870 2017] [wsgi:error] [pid 30307:tid 140437629064960] (2)No such file or directory: [client 172.31.32.163:24210] mod_wsgi (pid=30307): Unable to connect to WSGI daemon process 'web2py' on '/var/run/apache2/wsgi.30303.0.1.sock'. 
[Thu Sep 28 06:49:14.503732 2017] [wsgi:error] [pid 30307:tid 140437603886848] (2)No such file or directory: [client 172.31.14.173:37726] mod_wsgi (pid=30307): Unable to connect to WSGI daemon process 'web2py' on '/var/run/apache2/wsgi.30303.0.1.sock'. 

더 많은 정보가 필요하면 알려주세요.

답변

1

이것은 HTTP 클라이언트가 연결 유지 연결을 사용하고 동일한 연결을 통해 여러 요청을 발행 할 때 Apache를 정상적으로 다시 시작할 때 발생합니다.

문제는 Apache가 mod_wsgi 데몬 프로세스를 관리하는 방식이 정상적인 재시작 인 경우에도 즉시 종료된다는 것을 의미합니다. 그 동안 처음에는 요청을 받아들이는 Apache 하위 작업자 프로세스와 mod_wsgi 데몬 프로세스에 대한 프록시는 모든 클라이언트 연결이 끊어 질 때까지 계속 실행됩니다. 즉, 연결 유지 및 동일한 클라이언트 연결을 통한 후속 요청이 WSGI 응용 프로그램으로 이동해야하는 경우 이전에 mod_wsgi 데몬 프로세스의 이전 버전이 사라짐에 따라 실패합니다.

이 상황에서는 재시작 이유가 구성 변경이었고 이전 하위 작업자 프로세스가 데몬의 새 인스턴스에 연결할 수 있으므로 이전 Apache 하위 작업자 프로세스가 새 mod_wsgi 데몬 프로세스에 연결할 수 없습니다. 프로세스가 새로운 구성에서 요청이 그런 식으로 처리되지 않으면 보안 문제가 발생할 수 있습니다.

동의하지 않는 경우가 드물지만 보안 문제가 발생할 가능성은 희박합니다. mod_wsgi에 대한 새로운 옵션을 고려해 보면,이 경우 더 새로운 데몬 프로세스에 연결하는 것이 좋으며 다시 시작할 때 데몬 프로세스에 대한 수신기 소켓을 회전시키지 않는다고 말할 수 있습니다.

이런 일이 발생할 수 있다는 사실은 모두 (10 년) 알고 있었지만 GitHub에서 mod_wsgi와 같은 옵션을 고려하여 문제가 발생했습니다.

관련 문제