meejah / txtorcon

Twisted-based asynchronous Tor control protocol implementation. Includes unit-tests, examples, state-tracking code and configuration abstraction.
http://fjblvrw2jrxnhtg67qpbzi45r7ofojaoo3orzykesly2j3c2m3htapid.onion/
MIT License
250 stars 72 forks source link

Don't crash when there's no exitCode available #59

Closed Ryman closed 10 years ago

Ryman commented 11 years ago

I'm killing the subprocess via ProtocolProcess.transport.signalProcess('KILL') and it crashes badly (doesn't seem to let me just grab the exception and ignore it -_-) I'm resorting to horrid kills like that since the quit() on the controlProtocol doesn't seem to do anything (tried waiting up to 15 seconds) and therefore I get unbindable ports when I launch a new tor instance.

Also, pip isn't working for git installs on the repo due to /txtorcon.test not existing, if you don't want that commit I can remove it :)

coveralls commented 11 years ago

Coverage Status

Coverage remained the same when pulling c8bfa5cc4fb5b419103987b45caef8922b6c59ca on Ryman:none_exit_code into 200ba2e4862929f9c2b36ad24755a768885f9ec4 on meejah:master.

coveralls commented 11 years ago

Coverage Status

Coverage decreased (-0.14%) when pulling f4068cc752331b959beb885978fad4df8b8fb1c5 on Ryman:none_exit_code into 200ba2e4862929f9c2b36ad24755a768885f9ec4 on meejah:master.

meejah commented 11 years ago

Thanks for the patch. The problem you're describing is that quit() doesn't kill a Tor that you've started, correct? Was this Tor launched using launch_tor() or some other way? The quit() method just sends the QUIT command, which from what I understand should cause the Tor to exit if the controller has set TAKEOWNERSHIP properly. I note a FIXME comment in there, which could conceivably be (part of) the issue here.

If the Tor you're talking to wasn't launched by launch_tor() (or otherwise had TAKEOWNERHSIP and __OwningControllerProcess set) then I wouldn't expect quit() to cause it to actually exit.

Anyway, I'm taking a look at this stuff but may not have enough time to merge/fix until later in the week. Don't hesitate to bug me if that doesn't happen, or if you find out more. If you want to meet in #tor-dev send me email.

thanks,

Ryman commented 11 years ago

Hey @meejah ,

Sorry for the late reply, I've had real problems with internet this week.

Yeah, the processes I'm trying to kill are launched with launch_tor, and most of them with a timeout (which leaves processes with no real way to clean them up)

If I find out more I'll try and update.

meejah commented 10 years ago

merged relevant parts as part of docker-testing-2 merge.