Opened 11 years ago

Last modified 7 years ago

#823 closed defect (Fixed)

r16621 introduced random stream detaching

Reported by: TheJash Owned by: nickm
Priority: Low Milestone:
Component: Core Tor/Tor Version: 0.2.1.5-alpha
Severity: Keywords:
Cc: TheJash, nickm Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

When I use a relay of mine running a version later than r16621 as an exit to, for
example, http://upload.wikimedia.org/wikipedia/commons/7/79/Yellowjacket_nest_1_sjh.JPG
then the first few (between 3 and 100) times I try, the stream gets DETACHED with reason=END and
remote_reason=unknown. Re-attaching the stream to another circuit works fine, and then
the stream succeeds. If I keep trying the same address through my relay a bunch of times,
it eventually succeeds. However, restarting my CLIENT Tor program (which I'm using to
test this, ie, not the relay), and trying again at the same address causes the same problem.

I narrowed down the problem to this block in eventdns.c:

/* we only bother with the first four addresses. */
if (j + 4*addrtocopy > length) goto err;
if (name_matches) {

memcpy(&reply.data.a.addresses[reply.data.a.addrcount],

packet + j, 4*addrtocopy);

reply.data.a.addrcount += addrtocopy;
reply.have_answer = 1;
if (reply.data.a.addrcount == MAX_ADDRS) break;

}
j += 4*addrtocopy;

Note that the comments were added by me, and they actually fix this problem
(ie, the stream never detaches if those
's are present, but the problem DOES
happen when they are NOT present). However, I dont understand this code at all,
so I figured I'd submit a bug report with what I've figured out so far, and see
what you guys think.

I printed out the names right after the assignment of name_matches in that function,
and the print statement was run twice for a single stream attach try. This is what
my tor log (level=debug) looked like:
launch_resolve(): Launching eventdns request for [scrubbed]
eventdns: Resolve requested.
eventdns: Setting timeout for request 3afe38
eventdns: req->name = upload.wikimedia.org and tmp_name = upload.wikimedia.org
eventdns: req->name = upload.wikimedia.org and tmp_name = upload.pmtpa.wikimedia.org
eventdns: Removing timeout for request 3afe38

Note that I'm running windows XP, compiling from source, and in case it matters,
my DNS server is 192.168.1.1, which is my router running DD-WRT

Hope this helps!

[Automatically added by flyspray2trac: Operating System: All]

Child Tickets

Change History (5)

comment:1 Changed 11 years ago by nickm

Does r16933 fix this for you?

comment:2 Changed 11 years ago by TheJash

Yep, that fixed it. Thanks!

comment:3 Changed 11 years ago by nickm

Excellent; thanks for the great bug report!

comment:4 Changed 11 years ago by nickm

flyspray2trac: bug closed.

comment:5 Changed 7 years ago by nickm

Component: Tor RelayTor
Note: See TracTickets for help on using tickets.