We use Stem's launch_tor_with_config with the following config and then close all circuits opened by it (with close_circuit).

  • MaxCircuitDirtiness and NewCircuitPeriod: tens of hours
  • MaxClientCircuitsPending: 1

Then we build just one circuit by calling new_circuit (Stem) and set (set_conf) __DisablePredictedCircuits to 1 (since we cannot bootstrap with this setting).

After a while Tor starts building new circuits, which we don't want.

Most of the time we could find a sign of failure in the debug log just before the circuit creation, such as:

  • connection_ap_expire_beginning: "We tried for [10|15] seconds to connect to XX using exit XX Retrying on a new circuit"
  • connection_ap_process_end_not_open(): Address XX refused due to 'misc error'. Considering retrying.

How can we tell Tor to try really hard (longer timeouts, higher retry counts, ignore some connection failures etc.) before it opens a new circuit?

  • Why would you want to stop Tor from rotating circuits? What's your end goal with a setup like this? Commented Dec 12, 2013 at 15:03
  • @AndrewLott: Sorry for not mentioning the reason. This is for a website fingerprinting research project.
    – user709
    Commented Dec 12, 2013 at 16:02

1 Answer 1


Just looking through code on git I'm seeing:

int NewCircuitPeriod; /**< How long do we use 
                    a circuit before building... **/

Which makes me think that if "10s of hours" in seconds is easily overflowing an int. try around 30000 maybe?

  • 3
    A signed int on a 32 bit machine can be a bit over 2.1 billion. That's the number of seconds in 68 years and a bit. (Of course it's possible that shorts are used internally, but not likely. Haven't looked.)
    – Jobiwan
    Commented Dec 14, 2013 at 18:07

You must log in to answer this question.

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