On 26 November 2010 00:09, JE <[email protected]> wrote: > Hi! > > I'm pretty new to mod_wsgi. I have read through the most of mod_wsgi > documentation. I found answers to many of my questions, however there > is one topic I cannot find any information on. :/ > Let's assume I have a apache server with mod_wsgi in daemon mode. All > mod_wsgi processes and their threads process already a request. I > assume, that mod_wsgi cannot accept another request in this situation. > But what happens if another requests comes from apache now? Does > apache wait for mod_wsgi? If so where can I define the timeout ?
They queue up, albeit will eventually fail. New connections are accepted on a socket which has had listen() call done on it: http://www.opengroup.org/onlinepubs/009695399/functions/listen.html The queue back log is set by mod_wsgi to be: if (listen(sockfd, WSGI_LISTEN_BACKLOG) < 0) { ap_log_error(APLOG_MARK, WSGI_LOG_ALERT(errno), wsgi_server, "mod_wsgi (pid=%d): Couldn't listen on unix domain " "socket.", getpid()); return -1; } Where: #ifndef WSGI_LISTEN_BACKLOG #define WSGI_LISTEN_BACKLOG 100 #endif Thus up to 100 internal connection requests can queue up. If that limit is exceeded, then it will at that point fail and a retry mechanism within mod_wsgi will kick in: if (connect(daemon->fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { if (errno == ECONNREFUSED && retries < WSGI_CONNECT_ATTEMPTS) { ap_log_rerror(APLOG_MARK, WSGI_LOG_ERR(errno), r, "mod_wsgi (pid=%d): Connection attempt #%d to " "WSGI daemon process '%s' on '%s' failed, " "sleeping before retrying again.", getpid(), retries, daemon->name, daemon->socket); close(daemon->fd); You will start to see those connect attempt failure messages. If that goes on for a time, you will then have: ap_log_rerror(APLOG_MARK, WSGI_LOG_ERR(errno), r, "mod_wsgi (pid=%d): Unable to connect to " "WSGI daemon process '%s' on '%s' after " "multiple attempts.", getpid(), daemon->name, daemon->socket); close(daemon->fd); return HTTP_SERVICE_UNAVAILABLE; At that point, HTTP client will send a 503 error message indicating service unavailable. So, it will not die straight away. Graham -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/modwsgi?hl=en.
