[issue5715] listen socket close in SocketServer.ForkingMixIn.process_request()

Donghyun Kim report at bugs.python.org
Wed May 25 00:58:15 CEST 2011


Donghyun Kim <ryan003 at gmail.com> added the comment:

On May 24, 2011, at 12:44 PM, Charles-François Natali wrote:

> I don't know how I could miss this: closing the server socket is perfectly fine in TCP, since a new one is returned by accept(). But in UDP, it's definitely wrong, since it's used by the handler.
> I don't know however how I missed this, since I remember having run test_socketserver...

It's been a long time since the issue submitted, anyway, I was cursed to look at only TCP too :-)

I agree that ForkingUDPServer should be supported in SocketServer.py.
(Although users should take care of socket locking for concurrent accesses)

How about using BaseServer(TCPServer).server_close() instead of self.socket.close() in the patch?

As UDPServer has no server_close() method overridden, unlike ForkingTCPServer, ForkingUDPServer seems to have no actual "server" in design.
So, I think we could say that 
- closing TCP listen socket in child process = "server_close()" in child process
- nothing to do on UDP socket in child process = "server_close() but nothing will be done in the method" (b/c BaseServer.server_close() does nothing)

What do you think?

-----
Donghyun Kim
http://www.uryan.net

----------
Added file: http://bugs.python.org/file22098/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5715>
_______________________________________
-------------- next part --------------
<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 24, 2011, at 12:44 PM, Charles-François Natali wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>I don't know how I could miss this: closing the server socket is perfectly fine in TCP, since a new one is returned by accept(). But in UDP, it's definitely wrong, since it's used by the handler.<br>I don't know however how I missed this, since I remember having run test_socketserver...<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div>It's been a long time since the issue submitted, anyway, I was cursed to look at only TCP too :-)<br><br>I agree that ForkingUDPServer should be supported in SocketServer.py.<br>(Although users should take care of socket locking for concurrent accesses)<br><br>How about using BaseServer(TCPServer).server_close() instead of self.socket.close() in the patch?<br><br>As UDPServer has no server_close() method overridden, unlike ForkingTCPServer, ForkingUDPServer seems to have no actual "server" in design.<br>So, I think we could say that&nbsp;<br>- closing TCP listen socket in child process = "server_close()" in child process<br>- nothing to do on UDP socket in child process = "server_close() but nothing will be done in the method" (b/c BaseServer.server_close() does nothing)<br><br>What do you think?</div><div><br></div><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Malgun Gothic'; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; ">-----<br>Donghyun Kim<br><a href="http://www.uryan.net">http://www.uryan.net</a></span>
</div>
<br></body></html>


More information about the Python-bugs-list mailing list