Bugs item #1151968, was opened at 2005-02-25 18:00
Message generated for change (Comment added) made by gbrandl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1151968&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Windows
Group: Platform-specific
>Status: Closed
>Resolution: Works For Me
Priority: 5
Submitted By: Jonas Widén (jonsv322)
Assigned to: Nobody/Anonymous (nobody)
Summary: (XMLRPC) multitude of sockets ending up in TIME_WAIT

Initial Comment:
A problem with a multitude of sockets ending up in
TIME_WAIT when stressing a system with XML-RPC calls.
This can cause a Windows network to missbehave.

A solution on Windows platform is to set the sockopt
NOLINGER with parameters (1, 0) for the socket before
the socket is closed. This vill cause that Windows will
release the socket direct without going into TIME_WAIT.

The solution in code:
In [EMAIL PROTECTED]:
NOLINGER = struct.pack('HH', 1, 0) # Release the
resource back to the system if socket closed

In [EMAIL PROTECTED]:
self.sock.setsockopt(socket.SOL_SOCKET,
socket.SO_LINGER, NOLINGER)
self.sock.close()   # close it manually... there may be
other refs

----------------------------------------------------------------------

>Comment By: Georg Brandl (gbrandl)
Date: 2006-03-17 19:29

Message:
Logged In: YES 
user_id=849994

Seems like Not a Bug.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2005-02-25 20:53

Message:
Logged In: YES 
user_id=21627

Why do you want to avoid the TIME_WAIT state, and why do you
think it is a Python bug that it doesn't? See

http://www.developerweb.net/sock-faq/detail.php?id=13

where Richard Stevens himself explains that SO_LINGER should
*not* be used.

It might be that SO_REUSEADDR is sufficient, see

http://www.developerweb.net/sock-faq/detail.php?id=44

If you want xmlrpclib to use different socket options, you
should subclass httplib.HTTP to redefine either connect() or
close(), and you should subclass xmlrpclib.Transport to use
your subclassed transport.

----------------------------------------------------------------------

Comment By: Jonas Widén (jonsv322)
Date: 2005-02-25 20:13

Message:
Logged In: YES 
user_id=352221

Read section, SO_LINGER at following address:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/wspsetsockopt_2.asp


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1151968&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to