It seems clear to me that Tor has some facility for discovering when connectivity within a circuit is lost. I'd like to find that point and add a log_debug into it, as the current Tor logging does not seem to clearly and obviously call these things out. Can anyone point me into the correct source file?

So far I've been looking into the various onion_skin methods, but those seem to be used most when creating new circuits. I'm looking for something more general: ideally, to log both "this circuit cannot be brought up because node X cannot be reached" and "this existing circuit is failing because node X cannot be reached."

Many thanks to anyone who can offer some light.

  • Do you mean when streams (the connections to the destination server that are proxied through a circuit) stop working, or when the circuit itself stops working?
    – Steve
    Apr 22, 2021 at 3:17

1 Answer 1


You may be interested in using a Tor control library (for example Stem) to listen to events and log them. Check out sections 4.1.1 and 4.1.2 of the control protocol document for examples of the types of circuit and stream events you can listen for. This can also tell you the reason why a circuit or stream was closed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .