[tor-bugs] #9862 [Stem]: Tor hangs because stem isn't reading its stdout

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat May 31 19:11:40 UTC 2014


#9862: Tor hangs because stem isn't reading its stdout
------------------------+------------------------
     Reporter:  zwol    |      Owner:  atagar
         Type:  defect  |     Status:  closed
     Priority:  major   |  Milestone:
    Component:  Stem    |    Version:
   Resolution:  fixed   |   Keywords:  controller
Actual Points:          |  Parent ID:
       Points:          |
------------------------+------------------------
Changes (by atagar):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 Sweet, it works!
 [https://gitweb.torproject.org/stem.git/commitdiff/fcf49ad Fix pushed].

 I tested this with the following. Prior to the fix tor would hang after ~3
 seconds, but with the fix things happily chug along.

 {{{
 import time

 import stem.process

 from stem.control import EventType, Controller

 tor_process = stem.process.launch_tor_with_config(
   config = {
     'ControlPort': '9051',
     'Log': 'DEBUG stdout',
   },
   take_ownership = True,
 )

 with Controller.from_port() as controller:
   controller.authenticate()

   def heartbeat(event):
     print "%s - %s / %s" % (time.time(), event.read, event.written)

   controller.add_event_listener(heartbeat, EventType.BW)

   print "Press any key to quit..."
   raw_input()
 }}}

 Thanks for the catch!

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/9862#comment:22>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list