httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Damiano Barboni <>
Subject [users@httpd] CLOSE_WAIT management with apche2 and mod_python
Date Thu, 25 Nov 2010 15:33:41 GMT
Hi All,
I’m working with Apache2 and mod_python.

I have a server process that must run a long and heavy data processing.
If the client (the user) decides to stop the data processing, the server
receives the signal and the connection enters in a CLOSE_WAIT status
until the server process has finished. 

Since the resources utilization is high, I would like to manage the
CLOSE_WAIT status and I would like to force the server process to end.
Is there a method to allow the server process to see the connection
status and, in particular, to see if the connection is in CLOSE_WAIT ?

For example, considering the following code:

from mod_python import util
import apache, time, sys

def handler(req):     
    #infinite loop
    while True: 
        #open log file
        f = open("/home/damiano/www/test_close_wait.log","a")
        #exit if connection is in CLOSE_WAIT	
        if req.connection.aborted:
    req.content_type = 'text/html'
    return apache.OK

The infinite loop can be considered as my data processing. 
req.connection is the connection object associated with the request. 
req.connection.aborted is the element that i have tried to check but,
when the connection changes from ESTABLISHED to CLOSE_WAIT, this
variable does not change and remains to 0 (False).

Does anyone know how to deal with the problem and can help me.

Thanks in advance


The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:> for more info.
To unsubscribe, e-mail:
   "   from the digest:
For additional commands, e-mail:

View raw message