Bugs item #1515839, was opened at 2006-07-02 16:05 Message generated for change (Comment added) made by kirma You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1515839&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: Python Library Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Jari Kirma (kirma) Assigned to: Nobody/Anonymous (nobody) Summary: socket timeout inheritance on accept Initial Comment: Socket objects returned by socket.accept() get their blocking and timeout setting(s) from socket.defaulttimeout. This can be in conflict with reality of the (non-)blocking mode of actual OS-level socket they use. For instance, FreeBSD sockets inherit their socket options from the parent socket on accept(2) system call, and thus a socket object with defined socket timeout and default defaulttimeout returns a socket object that seems to be blocking, non-timeout socket, but the underlying OS socket is actually in nonblocking mode, which can cause read/recv and write/send operations to behave unexpectedly. Even worse, POSIX/SUSv3 doesn't explicitly require socket option inheritance (http://www.opengroup.org/onlinepubs/009695399/functions/accept.html). The socket library should explicitly set the socket timeout mode (either to defaulttimeout, or with accompanying documentation, inherit the value from socket object passed to accept()) and modify the OS socket options accordingly. ---------------------------------------------------------------------- >Comment By: Jari Kirma (kirma) Date: 2006-07-02 16:23 Message: Logged In: YES user_id=1548868 Making socket objects behave reliably can be achieved simply by always calling internal_setblocking in init_sockobject of socketmodule.c, but this causes overhead of one system call on all socket creations. Alternatively one could call internal_setblocking from sock_accept if parent socket has timeouts/nonblocking mode enabled. This should work in under all reasonable scenanarios and avoid system call overhead on majority of cases. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1515839&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com