[tor-bugs] #2412 [Torctl]: TorCtl isn't joining on _thread

Tor Bug Tracker & Wiki torproject-admin at torproject.org
Thu May 26 16:52:03 UTC 2011


#2412: TorCtl isn't joining on _thread
--------------------+-------------------------------------------------------
 Reporter:  atagar  |          Owner:  mikeperry
     Type:  defect  |         Status:  new      
 Priority:  major   |      Milestone:           
Component:  Torctl  |        Version:           
 Keywords:          |         Parent:           
   Points:          |   Actualpoints:           
--------------------+-------------------------------------------------------
Changes (by atagar):

  * priority:  minor => major


Comment:

 Ah ha! Have the reason reason why _thread is sometimes joinable and other
 times locks the interpretor. The reason is that _read_reply call in the
 _loop only returns if we get something on the control port. This is
 causing problems for arm and is the reason my patch for 2812 is causing
 deadlock so upping the severity. I'm not sure of the best method for
 getting readline() to stop blocking - help would be appreciated.

 09:25 < atagar> Uggg, this torctl _thread is annoying. If I don't join on
 it then I sometimes get interpretor shutdown exceptions
 (http://pastebin.com/8inZg7ay) but if I do then it ups arm's shutdown time
 (from instantaneous to around a second) and in some weird use cases causes
 deadlock.
 09:27 < atagar> mikeperry: Daemon threads evidently cause the interpretor
 to whine if they aren't joined before shutdown. Any thoughts on how to
 make TorCtl's close method clean up its _thread?
 09:28 < atagar> I'm not having much luck managing it externally :/
 09:29 < atagar> Ah ha! Think I know what's happening
 09:31 < atagar> The _read_reply call in the _loop method is returning when
 we receive an event so if I'm listening to BW events then it returns, hits
 the TorCtlClosed condition, and can be joined.
 09:31 < atagar> since BW events happen every second this is why arm's
 shutdown time is now around a second
 09:32 < atagar> but if we aren't listening for events then _read_reply
 never returns and the join on _thread causes arm to lock up
 09:32 < atagar> hacky solution: somehow force tor to send something on its
 control port so torctl will wake up and shut down
 09:34 < atagar> better solution: make the torctl close somehow stop
 blocking on readline()

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


More information about the tor-bugs mailing list