[New-bugs-announce] [issue10340] asyncore doesn't properly handle EINVAL on OSX
report at bugs.python.org
Sat Nov 6 15:56:32 CET 2010
New submission from Giampaolo Rodola' <g.rodola at gmail.com>:
This comes from a user who sent me a report via e-mail. Unfortunately I don't have an OSX box to test against.
Code which should replicate the problem is this:
import socket, struct
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
...while this is a fix I think it should work:
--- Lib/asyncore.py (revisione 86084)
+++ Lib/asyncore.py (copia locale)
@@ -242,7 +242,7 @@
self.addr = sock.getpeername()
except socket.error, err:
- if err.args == ENOTCONN:
+ if err.args in (ENOTCONN, EINVAL):
# To handle the case where we got an unconnected
self.connected = False
Nosying ixokai as I know he has an OSX box to test against.
Setting "high" priority and type == "security" as asyncore-based servers are likely to crash because of this.
It might even make sense to backport the fix in Python 2.6 because of the security implications.
components: Library (Lib)
nosy: giampaolo.rodola, ixokai
stage: patch review
title: asyncore doesn't properly handle EINVAL on OSX
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce