<div dir="auto">The problem got resolved, once I closely analyzed the tor INFO logs.<div dir="auto">Main problem was that the exit nodes in the circuit were refusing connections due to their exit policies, because our application ran on some random ports.</div><div dir="auto">Running out application on tor exit supported ports worked for a while.</div><div dir="auto"><br></div><div dir="auto">But a new problem arised once the above was resolved i.e. tor was dropping connections again giving the reason to be "We tried for 10 seconds to connect to <server_ip> using exit <exit-node-fingerprint>~<exit-node-nick> at <exit-node-ip>. Retrying on a new circuit." </div><div dir="auto"><br></div><div dir="auto">I've been trying to analyse the INFO level logs, but haven't been able to find more information as why this error is happening. </div><div dir="auto"><br></div><div dir="auto">Are there any possible reasons as to why this might be happening and any possible fixes for this situation?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 20 Feb 2019, 18:08 Piyush Kumar Sharma, <<a href="mailto:piyushs@iiitd.ac.in">piyushs@iiitd.ac.in</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>After a lot of debugging, it seems that the reason for streams failing is as follows : <br></div><div>As soon as a new stream is made, it goes into the NEW state according to Torctl logs.</div><div>Then with stem or carml running, they try to attach it to the specified circuit.</div><div>As soon as the stream is attached, it moves to the SENTCONNECT, and if it doesn't succeed, the state of that stream again changes to NEW after which the connection fails (the stream waits for the 120s then gets closed automatically with error code REASON_TIMEOUT).</div><div>A point i noted was that, a stream is in the SENTCONNECT state for a very short duration (fraction of seconds).</div><div><br></div><div>Other times, when the above process does not happen, the streams successfully move to the SUCCEEDED state after SENTCONNECT and are served through the specified circuit.</div><div>But this behavior seems to be completely random. Is there a way to resolve this issue?</div><div><br></div><div>@meejah : carml had the same problem as with stem as already explained above.</div><div>@Nick Mathewson : Yes there are some instances where the circuit creation itself takes a lot of time and fails sometimes. But those cases are already handled. The main problem as we could drill down is explained above. <br></div><div><br></div><div><br></div><div><div><div dir="ltr" class="m_-6076831879042259119m_8721858403668872820gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Regards<br>Piyush<br></div></div><br></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 20, 2019 at 7:40 AM Nick Mathewson <<a href="mailto:nickm@alum.mit.edu" target="_blank" rel="noreferrer">nickm@alum.mit.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Feb 18, 2019 at 1:04 PM Piyush Kumar Sharma <<a href="mailto:piyushs@iiitd.ac.in" target="_blank" rel="noreferrer">piyushs@iiitd.ac.in</a>> wrote:<br>
><br>
> Hello all,<br>
><br>
> I am a PhD student, and am working on some measurements in Tor.<br>
> I am stuck at a point where i need to send multiple applications(streams) traffic through a single circuit.<br>
> I am currently using torsocks/torify to send traffic of these multiple applications through Tor.<br>
> The main problem is that, despite trying many different ways to achieve the same (sending multiple streams through a single circuit), i am not successful.<br>
><br>
> Things i have tried :<br>
> 1.) Force Tor process to create only a single circuit at a time preventing any new circuit creation, so that any new stream would be attached to this only available circuit. To acheive this i have set the following Tor options :<br>
> set __DisablePredictedCircuits to 1<br>
> set MaxClientCircuitsPending to 1<br>
> set newcircuitperiod to 999999999<br>
> set maxcircuitdirtiness to 999999999<br>
> The problem with the above method is that it seems to work sometimes randomly. But most of the times for some reason, a new circuit is still created.<br>
><br>
> 2.) Next, i assumed that maybe running torify multiple times for each application is the culprit, as it may try to create new circuit for each run. So i created a new bidirectional stream using socat, which listens on a local TCP port, and forwards the data to the Tor SOCKS port assuming that it will lead to a singe connection to local SOCKS.<br>
> Even this did not work and still new circuits were created randomly.<br>
><br>
> 3.) Next i tried to attach streams to circuits manually, using the stem library following the link : <a href="https://stem.torproject.org/tutorials/to_russia_with_love.html#custom-path-selection" rel="noreferrer noreferrer" target="_blank">https://stem.torproject.org/tutorials/to_russia_with_love.html#custom-path-selection</a> . This seemed to work initially, but then after every 4-5 runs, the streams seemed to detach automatically. Moreover, the original circuit crashed too.<br>
<br>
The stem approach (#3) ought to work in general -- the information<br>
here isn't enough to tell what the problem is, exactly. Is it possible<br>
that the circuit you are constructing is failing for some reason?<br>
<br>
-- <br>
Nick<br>
_______________________________________________<br>
tor-dev mailing list<br>
<a href="mailto:tor-dev@lists.torproject.org" target="_blank" rel="noreferrer">tor-dev@lists.torproject.org</a><br>
<a href="https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev" rel="noreferrer noreferrer" target="_blank">https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev</a><br>
</blockquote></div>
</blockquote></div>