I'm running some experiments using the stem library where I change circuit paths fairly frequently. Every so often, I get a stream detached event and a Socks5Error: 'TTL Expired' in my Python script, and at the same time I get something like Jan 12 12:09:52.000 [notice] Tried for 120 seconds to get a connection to [scrubbed]:6667. Giving up. (waiting for controller) in my Tor log.

Does anyone have any idea why this might be occurring, and how I could either prevent it or even recover from it? I tried catching the exception, waiting, and then getting a new controller (with Controller.from_port) but the attempt to get a new controller throws a Socks5Error as well. Once I restart the script though, everything works fine until the error occurs agin.

Even if the error can't be prevented, I'd like the script to be able to keep going on it's own.

  • A few places actually block IRC (port 6667). Try using a different port, if you can. Jan 13 '14 at 7:46
  • If it's listed in their "rejected" ports list in the directory then that shouldn't be it, because I'm only using Tor exit nodes that say they allow exiting to *:6667 Jan 13 '14 at 17:39
  • That doesn't eliminate the possibility that you've hit a bad exit, one whose ISP blocks the port (and the exit node operator is unaware of this). Jan 14 '14 at 0:57
  • Maybe you can set SafeLogging 0 in your torrc, get the failing IP and test it using another Tor client or by other means.
    – Jens Kubieziel
    Jan 20 '14 at 21:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.