UDP crashes python.exe when using IOCPReactor
|Reported by:||JoshAlbrecht||Owned by:|
branch-diff, diff-cov, branch-cov, buildbot
The program below causes python.exe to crash. I've tested on Windows XP 32Bit, Windows 7 64bit, and I've tested with Python 2.5.2 and 2.6.4, and I've tested using both Twisted 9.0.0 and 8.2.0. It has crashed with every combination.
One interesting thing to note is that it crashes with no output if you comment out the for loop (even with the for loop, it crashes with no output on my windows XP system). Usually I get this output though:
C:\Python25\lib\site-packages\twisted\internet\iocpreactor\reactor.py:29: UserWarning: pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. It is missing, so the reactor will not support SSL APIs.
"pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. "
(('127.0.0.1', 6951), 'HELLO') (('127.0.0.1', 33351), 'HELLO')
Sometimes more or fewer HELLO lines are printed.
from twisted.internet.iocpreactor.reactor import IOCPReactor from twisted.internet.main import installReactor from twisted.internet.protocol import DatagramProtocol reactor = IOCPReactor() installReactor(reactor) DATA = 'HELLO' REMOTE_IP = "127.0.0.1" REMOTE_PORT = 33351 class EchoDatagram(DatagramProtocol): def datagramReceived(self, datagram, addr): print((addr, datagram)) self.transport.write(datagram, addr) p1 = EchoDatagram() listening_port1 = reactor.listenUDP(6951, p1, interface='') p2 = EchoDatagram() listening_port2 = reactor.listenUDP(REMOTE_PORT, p2, interface=REMOTE_IP) def pointless_write(): p1.transport.write(DATA, (REMOTE_IP, REMOTE_PORT)) for i in xrange(10): f = open("temp1", "wb") f.write("Hi!") f.close() f = open("temp1", "rb") data = f.read() f.close() reactor.callLater(1, pointless_write) reactor.callLater(1, pointless_write) reactor.run()
Change History (14)
comment:1 Changed 7 years ago by exarkun
- Keywords windows added
- Owner changed from glyph to PenguinOfDoom
- Priority changed from highest to normal
comment:5 Changed 6 years ago by PenguinOfDoom
- Branch branches/recvfrom-segfault-4172 deleted
- Keywords review added
- Owner changed from PenguinOfDoom to exarkun
- Priority changed from normal to highest
comment:7 follow-up: ↓ 9 Changed 6 years ago by itamar
- Keywords review removed
- Owner set to PenguinOfDoom