UDP crashes python.exe when using IOCPReactor
[email protected] Tue, 15 Dec 2009 23:45:30 -0000
| Newsgroups | gmane.comp.python.twisted.bugs |
|---|---|
| Message-ID | <[email protected]> |
New submission from JoshAlbrecht <None>:
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.
{{{
#!python
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()
}}}
----------
Type : defect
Component: core
Keywords :
Priority : highest
Nosy :
----------
http://twistedmatrix.com/trac/ticket/4172