Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#14224 closed defect (fixed)

Two minutes after a failed hidserv connection, we do a bonus hsdesc fetch

Reported by: arma Owned by:
Priority: Medium Milestone: Tor: 0.2.6.x-final
Component: Core Tor/Tor Version:
Severity: Keywords: tor-hs
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor: SponsorR

Description

If you do the steps to reproduce #14219, you end up eventually hanging up on the hidden service stream attempt: your controller events include

1421356924.815634 [torctl-log] localhost:9051 650 HS_DESC REQUESTED yjiqkj6p7drpiwyq NO_AUTH $0B5E5E70FFEA9C7F9FFD13B8E16916A608F3E9EB~CalyxInstitute08 blwd4dzs2mnncf4wtc3bpv6pljwx5awb
1421356925.596473 [torctl-log] localhost:9051 650 HS_DESC RECEIVED yjiqkj6p7drpiwyq NO_AUTH $0B5E5E70FFEA9C7F9FFD13B8E16916A608F3E9EB~CalyxInstitute08

and your Tor debug log says

Jan 15 16:22:05.595 [info] connection_dir_client_reached_eof(): Received rendezvous descriptor (size 3254, status 200 ("OK"))
Jan 15 16:22:05.596 [info] rend_cache_store_v2_desc_as_client(): We already have a new enough service descriptor for service ID yjiqkj6p7drpiwyq with the same desc ID and version.
Jan 15 16:22:05.596 [info] connection_dir_client_reached_eof(): Successfully fetched v2 rendezvous descriptor.
Jan 15 16:22:05.596 [notice] Closing stream for 'yjiqkj6p7drpiwyq.onion': hidden service is unavailable (try again later).
Jan 15 16:22:05.596 [info] rend_client_note_connection_attempt_ended(): Connection attempt for yjiqkj6p7drpiwyq has ended; cleaning up temporary state.
Jan 15 16:22:05.596 [info] rend_client_note_connection_attempt_ended(): Connection attempt for yjiqkj6p7drpiwyq has ended; cleaning up temporary state.

and then your application stream gets closed.

Then two minutes later (!), you see these controller events:

1421357045.919921 [torctl-log] localhost:9051 650 HS_DESC REQUESTED yjiqkj6p7drpiwyq NO_AUTH $0B569B9F3999ACA1E7F52EA2C41841F9DDA89C3D~Unnamed blwd4dzs2mnncf4wtc3bpv6pljwx5awb
1421357047.114483 [torctl-log] localhost:9051 650 HS_DESC RECEIVED yjiqkj6p7drpiwyq NO_AUTH $0B569B9F3999ACA1E7F52EA2C41841F9DDA89C3D~Unnamed

It turns out that happens because the intro circuit finally closes:

Jan 15 16:24:05.918 [info] circuit_expire_building(): Abandoning circ 5 195.154.127.246:9001:2375802890 (state 1,3:open, purpose 6, len 6)
Jan 15 16:24:05.918 [info] internal circ (length 6): $4FEE77AFFD157BBCF2D896AE417FBF647860466C(open) $F4F605AA21C4633CCB5B8DBBC1CEEE5C590C6DCE(open) $B6D30CEC9F8FAB676CCD0634DC86412F1BA8F4D2(open) $5B3B9A0EA1DC16F6348C57FCC83BBB43D1013F4A(open) $10B6A20E3F1D0C0742053A19242AB61586A5B9B4(open) $D51C1F3A39FB0BCA12D2795F67B1FA93A750218D(open)

which is reasonable, except, then:

Jan 15 16:24:05.918 [info] circuit_mark_for_close_(): Failed intro circ yjiqkj6p7drpiwyq to $D51C1F3A39FB0BCA12D2795F67B1FA93A750218D (building circuit to intro point). Marking intro point as possibly unreachable.
Jan 15 16:24:05.918 [info] rend_client_report_intro_point_failure(): Unknown service "yjiqkj6p7drpiwyq". Re-fetching descriptor.
Jan 15 16:24:05.918 [debug] rend_client_refetch_v2_renddesc(): Fetching v2 rendezvous descriptor for service yjiqkj6p7drpiwyq

It looks like the closing of the intro circuit, 2 minutes later, triggers another fetching of a descriptor!

Child Tickets

Change History (7)

comment:1 Changed 4 years ago by arma

I talked to dgoulet about the options here, and we think the most plausible plan forward is to close this intro circuit when it gets a nack that causes the last intro point to be removed from our local copy of the hsdesc.

In particular, at the bottom of rend_client_introduction_acked(), when rend_client_report_intro_point_failure() returns <1, that should be our cue to close the intro circuit.

We might need to do it in such a way that we don't trigger an "oh gosh the intro circuit closed, quick, launch a descriptor fetch" conclusion though.

comment:2 Changed 4 years ago by nickm

How hard is a fix for this? Might it fit in 0.2.6?

comment:3 Changed 4 years ago by dgoulet

Hrm, the fix is quite straight forward by adding a check in rend_client_introduction_acked() but the second part of not triggering an HS fetch, there are multiple ways of doing that, wondering what would be ideal.

circuit_mark_for_close() checks at the circuit purpose to know if it has to report an intro point failure which we don't want here else it will trigger a fetch. Here is what I'm thinking:

1) Before closing the intro circuit, change purpose to CIRCUIT_PURPOSE_C_INTRODUCE_ACKED which is in a way true since we got a negative ACK thus not triggering a intro point report failure and fetch desc.

2) Flag in rend_data_t that tells us that no more intro points are usable if set (only client side).

3) Flag the circuit but yuk...

I'll go for 1) here for simplicity and also make sense "codeflow wise".

Note that rend_client_report_intro_point_failure() triggers a HS fetch if there are no more usable intro points so once we got the third NACK (considering 3 intro points at the beginning), a fetch will automatically be triggered but at least the "close intro circuit" will not trigger one as well.

See branch bug14224_025_v1 in my repo for 1).

comment:4 Changed 4 years ago by dgoulet

Milestone: Tor: 0.2.???Tor: 0.2.6.x-final
Status: newneeds_review

comment:5 Changed 4 years ago by arma

Patch looks ok to me. Note that the branch name is _025_ but this is probably fine for _026_ with no backport. Thanks!

(Oh, small change, "it's reason is changed" in the commit message and "it's purpose" in the code comment.)

comment:6 Changed 4 years ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged to 0.2.6!

comment:7 Changed 4 years ago by dgoulet

Keywords: SponsorR removed
Sponsor: SponsorR
Note: See TracTickets for help on using tickets.