I use privoxy in combination with Tor. Sometimes when I visit a website I get the following error:
127.0.0.1: SOCKS5 TTL expired
How can I stop this from happening? In most cases it gets fixed by restarting Tor but that is not ideal.
What is happening is that Tor is returning the SOCKS error code
SOCKS5_TTL_EXPIRED (0x06) as a result of a stream being closed for reason
END_STREAM_REASON_TIMEOUT. There are many potential reasons why this might be happening but to find out which stream is timing out, and why, you should try enabling logging at level INFO.
Most likely, the circuit you are using is going through one or more overloaded nodes and so your client is not getting a response in time. Alternatively there may be a problem with DNS resolution at the exit node you are using. If you are accessing a hidden service then there are more nodes in the circuit so it is more likely this error will be triggered.
Retrying the request should normally clear this problem and it should not require restarting Tor – if a stream is failing then the circuit selected should be marked as unusable. If the problem keeps occurring until Tor gets restarted then it could be a bug and would be interesting to investigate further.