id	summary	reporter	owner	description	type	status	priority	milestone	component	resolution	keywords	cc	branch	branch_author	launchpad_bug
3680	Reactor stop claims reactor not running when both a callLater and a StandardIO are active	bhyde		"{{{

bash-3.2$ (sleep 2; date +%s; sleep 2; date +%s ; sleep 10) | /tmp/bar.py
1236440028
1236440030
done
Traceback (most recent call last):
  File ""/opt/local/lib/python2.5/site-packages/twisted/python/context.py"", line 59, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File ""/opt/local/lib/python2.5/site-packages/twisted/python/context.py"", line 37, in callWithContext
    return func(*args,**kw)
  File ""/opt/local/lib/python2.5/site-packages/twisted/internet/process.py"", line 258, in connectionLost
    self.proc.childConnectionLost(self.name, reason)
  File ""/opt/local/lib/python2.5/site-packages/twisted/internet/_posixstdio.py"", line 86, in childConnectionLost
    self.connectionLost(reason)
--- <exception caught here> ---
  File ""/opt/local/lib/python2.5/site-packages/twisted/internet/_posixstdio.py"", line 105, in connectionLost
    protocol.connectionLost(reason)
  File ""/tmp/bar.py"", line 9, in connectionLost
    def connectionLost(self, why): reactor.stop()
  File ""/opt/local/lib/python2.5/site-packages/twisted/internet/base.py"", line 490, in stop
    ""Can't stop reactor that isn't running."")
twisted.internet.error.ReactorNotRunning: Can't stop reactor that isn't running.
bash-3.2$ cat /tmp/bar.py
#!/usr/bin/env python
from twisted.internet import reactor
from twisted.protocols.basic import LineOnlyReceiver
from twisted.internet.stdio import StandardIO

class MyLineOnlyReceiver(LineOnlyReceiver):
    delimiter = '\n'
    def lineReceived(self, line): print line
    def connectionLost(self, why): reactor.stop()

if __name__ == '__main__':
    StandardIO(MyLineOnlyReceiver())
    def finish():
        print 'done'
        reactor.stop()
    reactor.callLater(10, finish)
    reactor.run() 
bash-3.2$ port info 'py25-twisted'
py25-twisted @8.0.1 (python, devel, net)

Twisted is an event-driven networking framework written in Python. Twisted supports TCP,
UDP, SSL/TLS, multicast, Unix sockets, a large number of protocols (including HTTP, NNTP,
SSH, IRC, FTP, and others), and much more.
Homepage:    http://www.twistedmatrix.com/

Library Dependencies: python25, py25-zopeinterface
Maintainers:          stechert@macports.org akitada@macports.org
                      openmaintainer@macports.org
bash-3.2$ python -V
Python 2.5.4
bash-3.2$ uname -a
Darwin d72.cozy.org 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386 i386
bash-3.2$ 
}}}"	defect	closed	normal		core	wontfix					
