What does the Tor Project recommend to be the best timeout setting to use when contacting an onion service?

I'm wrapping an ancient perl script with torsocks so that it can reach my website via its .onion address, but I'm getting a lot of these errors

torsocks[xxxx]: Connection timed out (in socks5_recv_connect_reply() at socks5.c:547)
torsocks[yyyy]: Host unreachable (in socks5_recv_connect_reply() at socks5.c:539)

The perl script defaults to a timeout of 30 seconds, but I know that we should expect higher latency on the Tor network.

I also know that Tor Browser is a modified version of Firefox, so I wonder: does the Tor Project make any modifications to the default timeouts of Firefox when shipping the Tor Browser so it is more tolerant of this latency? If so, what?

What does the Tor Project best-practices suggest that we should use for timeouts (in seconds) when attempting to reach an onion service?


You should use your system's default for all tcp timeouts, which is likely 60-90 seconds.

A quick diff of the about:config settings matching network.http*timeout in the following two browsers:

  • Mozilla Firefox 78.6.1esr and
  • Tor Browser 8.5.5 (based on Mozilla Firefox 60.9.0esr)

...shows two differences

  1. network.http.connection-retry-timeout and
  2. network.http.fallback-connection-timeout

The first one (network.http.connection-retry-timeout) is 250 (ms) in Firefox and 0 in Tor Browser. There's more info about this change here:

The second one (network.http.fallback-connection-timeout) doesn't exist in the Tor Browser at all. I'm guessing it's a newer Firefox thing that may pop-up in Tor Browser at a later date?

Anyway, reading through the Tor Project's gitlab issue in the link above (and the fact that almost all of the about:config network.http* timeouts align in vanilla Firefox and the Tor Browser), it seems that the official opinion of the Tor Project is, more-or-less: leave the timeouts at their defaults--which is likely 60-90 seconds, depending on your OS.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.