Tor builds+discards conflux circuits every 30 seconds when no predicted ports
Run your Tor client and then leave it alone for an hour, so the predicted ports expire. After that your Tor is supposed to stop building preemptive circuits (because there are no predicted ports so no need for preemptive circuits), but instead it builds preemptive ones with a super short idle timeout, closes them soon after because it doesn't need them, discovers it doesn't have any and builds new ones, ad infinitum.
I am building and discarding six circuits every 30 seconds, for the past days:
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47534 that has been unused for 30979 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 2260996702 (id: 47534) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47533 that has been unused for 30984 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 3982976499 (id: 47533) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47532 that has been unused for 30992 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 2475493960 (id: 47532) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47531 that has been unused for 30996 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 3823807377 (id: 47531) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47530 that has been unused for 31004 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 4285808499 (id: 47530) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47529 that has been unused for 31009 msec.
Oct 14 23:49:10.529 [info] circuit_mark_for_close_(): Circuit 4146356429 (id: 47529) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:10.529 [info] conflux_predict_new(): Preemptively launching new conflux circuit set(s). We have 0 linked and 0 unlinked.
Oct 14 23:49:10.529 [info] conflux_launch_leg(): Launching new conflux set for nonce 07C7DB55D85D2D1C.
Oct 14 23:49:10.529 [info] origin_circuit_new(): Circuit 47535 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:10.541 [info] conflux_launch_leg(): Launching conflux leg for nonce 07C7DB55D85D2D1C.
Oct 14 23:49:10.541 [info] origin_circuit_new(): Circuit 47536 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:10.547 [info] conflux_launch_leg(): Launching new conflux set for nonce 23A7086DCF5BF6A0.
Oct 14 23:49:10.547 [info] origin_circuit_new(): Circuit 47537 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:10.554 [info] conflux_launch_leg(): Launching conflux leg for nonce 23A7086DCF5BF6A0.
Oct 14 23:49:10.554 [info] origin_circuit_new(): Circuit 47538 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:10.559 [info] conflux_launch_leg(): Launching new conflux set for nonce 01745EB44191F128.
Oct 14 23:49:10.559 [info] origin_circuit_new(): Circuit 47539 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:10.567 [info] conflux_launch_leg(): Launching conflux leg for nonce 01745EB44191F128.
Oct 14 23:49:10.567 [info] origin_circuit_new(): Circuit 47540 chose an idle timeout of 1 based on 0 seconds of predictive building remaining.
[...]
Oct 14 23:49:11.371 [info] conflux_circuit_has_opened(): Conflux circuit has opened with nonce 07C7DB55D85D2D1C
[...]
Oct 14 23:49:11.494 [info] conflux_circuit_has_opened(): Conflux circuit has opened with nonce 23A7086DCF5BF6A0
[...]
Oct 14 23:49:11.606 [info] conflux_circuit_has_opened(): Conflux circuit has opened with nonce 01745EB44191F128
[...]
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47540 that has been unused for 30986 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 3395355843 (id: 47540) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47539 that has been unused for 30991 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 4177888036 (id: 47539) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47538 that has been unused for 30998 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 3398362932 (id: 47538) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47537 that has been unused for 31003 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 3584428715 (id: 47537) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47536 that has been unused for 31010 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 3912526365 (id: 47536) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] circuit_expire_old_circuits_clientside(): Closing circuit 47535 that has been unused for 31017 msec.
Oct 14 23:49:41.558 [info] circuit_mark_for_close_(): Circuit 3231460415 (id: 47535) marked for close at src/core/or/circuituse.c:1497 (orig reason: 9, new reason: 0)
Oct 14 23:49:41.558 [info] conflux_predict_new(): Preemptively launching new conflux circuit set(s). We have 0 linked and 0 unlinked.
Oct 14 23:49:41.558 [info] conflux_launch_leg(): Launching new conflux set for nonce 9C5359062E72F37E.
and the cycle repeats.
Each Tor that is trapped in this cycle adds load of 3*6/30 = 0.6 circuit handshakes per second onto the network. That's most relays and bridges, and maybe quite a few of our 8 million ish clients too if they haven't received a user request in the last hour.
Originally reported by @um on irc, and I rediscovered it when I was (unrelatedly) trying to debug https://gitlab.torproject.org/tpo/network-health/analysis/-/issues/81