CLOSE_WAIT management with apche2 and mod_python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: 
        time.sleep(2)      
        #open log file
        f = open("/home/damiano/www/test_close_wait.log","a")
        f.write(str(req.connection.aborted))
        f.write("\n")
        f.close()
	
        #exit if connection is in CLOSE_WAIT	
        if req.connection.aborted:
            sys.exit(1)
    
    req.content_type = 'text/html'
    req.write("<p>END</p>")
    
    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

Damiano



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux