1

I was doing some experiments for a project on a Tor test network. I used Chutney to set up a small network and Stem to control one of the client nodes in the network. Because I made some changes on a relay node, I wanted to set up a circuit containing that node and run some quick experiments. My changes made the relay node run much slower, so I also need to change some default timeout settings.

I used the following code to set up a new circuit:

circuit_id = controller.new_circuit(path=["test009r", "test008r"], purpose='general', await_build=True)

The new circuit contains two relay nodes. I made some changes on the test009r node. Circuit building failed at runtime because:

Circuit failed to be created: CHANNEL_CLOSED

I believe it was because of some timeout, so I configured the client node:

controller.set_conf("MaxCircuitDirtiness", "60000")
controller.set_conf("LearnCircuitBuildTimeout", "0")
controller.set_conf("CircuitBuildTimeout", "60000")
controller.set_conf("CircuitStreamTimeout", "60000")

I tried to set large timeout windows, but it seemed like Tor just ignored them, because I still got the same error. I also tried:

controller.signal(stem.Signal.HUP)

after set_conf to "refresh" the configuration of the client node. When running controller.get_conf_map, I was able to confirm that those configurations did change. This part of the info.log might be relevant:

Jul 16 22:29:55.295 [info] circuit_build_times_set_timeout(): Set buildtimeout to low value 485.535223ms. Setting to 1500ms
Jul 16 22:29:55.417 [info] circuit_build_times_set_timeout(): Based on 164 circuit times, it looks like we don't need to wait so long for circuits to finish. We will now assume a circuit is too slow to use after waiting 2 seconds.
Jul 16 22:29:55.428 [info] circuit_build_times_set_timeout(): Circuit timeout data: 1500.000000ms, 60000.000000ms, Xm: 75, a: 0.861692, r: 0.170732
Jul 16 22:29:55.522 [info] circuit_build_times_filter_timeouts(): We had 28 timeouts out of 164 build times, and filtered 0 above the max of 60000

But I am not sure how to parse them. For example, from Tor's documentation, 60000 should be in seconds, but not ms?

  • Are you sure that those log lines were from after you changed the config? The circuit_build_times_set_timeout() function should exit immediately if LearnCircuitBuildTimeout is 0. The default CircuitBuildTimeout is 60000 ms, so this number should be expected if it's before you changed the config setting. – Steve Jul 17 at 4:56
  • Also a CHANNEL_CLOSED message means that this probably isn't a timeout problem. The circuit build is failing because the network connection between the two relays is closing. How soon after tying to build a circuit do you get this error? – Steve Jul 17 at 5:01
  • Thanks @Steve. Your comments made me realize I was looking at logs of a wrong node (i.e., the relay node); I should instead check the client node log to see if its settings have changed. I removed all my changes and just wanted to check if set_conf works. Here is what I saw from the client log: Jul 17 03:01:39.064 [info] options_validate_cb(): You disabled LearnCircuitBuildTimeout, but didn't specify a CircuitBuildTimeout. I'll pick a plausible default. Although I did later specify, I saw no more logs regarding CircuitBuildTimeout (or CircuitStreamTimeout, MaxCircuitDirtiness). Any guess? – vanbastelaer Jul 17 at 15:06
  • You should use set_options() instead to set multiple related settings at the same time. – Steve Jul 17 at 15:11
  • Will do @Steve. Re: CHANNEL_CLOSED. The script hung for a couple of minutes before I received the error. I seem to have a hard time finding any relevant logs in the client or the relay nodes. Are there any keywords I should be searching for in the logs, say, if the relay node is not reachable or the connection is closed? Thank you so much. – vanbastelaer Jul 17 at 15:49

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.