This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: multiprocessing: SocketListener should use SO_REUSEADDR
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: jnoller Nosy List: giampaolo.rodola, jnoller, jon_dee
Priority: high Keywords: patch

Created on 2009-02-07 14:13 by jon_dee, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg81336 - (view) Author: Jon Dee (jon_dee) Date: 2009-02-07 14:13
Without this flag it is necessary to wait for e.g. 120s after closing
down a 'BaseManager' server before restarting, due to the socket being
in the TIME_WAIT state. 

Example error, which occurs if a server is started, data transmitted
down the socket, the server shut down, then restarted:

     File "/usr/local/lib/python2.6/multiprocessing/connection.py", line
220, in __init__
        self._socket.bind(address)
     File "<string>", line 1, in bind
        error: [Errno 48] Address already in use


I added (locally):
     self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

to SocketListener.__init__, and it resolves the issue.
msg84568 - (view) Author: Jesse Noller (jnoller) * (Python committer) Date: 2009-03-30 15:51
Resolved in r70717 on python trunk. Will merge back into 2.6-maint later 
today. Test added as well.
History
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49427
2009-03-30 15:52:54jnollersetstatus: open -> closed
2009-03-30 15:51:44jnollersetresolution: fixed
messages: + msg84568
2009-03-29 15:45:02jnollersetpriority: high
2009-03-06 21:44:08ajaksu2setkeywords: + patch
assignee: jnoller
stage: test needed
2009-02-07 17:33:45pitrousetnosy: + jnoller
2009-02-07 15:03:54giampaolo.rodolasetnosy: + giampaolo.rodola
2009-02-07 14:13:03jon_deecreate