#24161 closed defect (fixed)

Recalculating voting schedule should be called first when setting a new consensus

Reported by: dgoulet Owned by: dgoulet
Priority: Medium Milestone: Tor: 0.3.2.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-sr, tor-relay
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

In networkstatus_set_current_consensus(), at some point the if (is_usable_flavor) does a series of action on the newly set consensus.

One of those is nodelist_set_consensus() which among many things will compute the HSv3 HSDir index for every node_t in this new consensus. That step requires the voting schedule object to be defined too compute time periods that the HS subsystem needs requiring the voting schedule timings.

So, the very first thing we should do when we get a new usable consensus is set its voting schedule timings. That is call dirvote_recalculate_timing(options, now); which is currently after the nodelist set.

This has been observed by this Bug when tor starts with the latest change in #23623:

Nov 07 15:39:09.364 [notice] Bootstrapped 0%: Starting
Nov 07 15:39:09.978 [warn] tor_timegm(): Bug: Out-of-range argument to tor_timegm (on Tor 0.3.3.0-alpha-dev c6c4a421fd7d8a0d)
Nov 07 15:39:09.978 [warn] dirvote_get_start_of_next_interval(): Bug: Ran into an invalid time when trying to find midnight. (on Tor 0.3.3.0-alpha-dev c6c4a421fd7d8a0d)
...

The other thing I wondered is if we should add a safe guard to the public function dirvote_get_next_valid_after_time() to calculate the timings in case the voting schedule is zeroed because in this case, this is where the issue comes from, that function returns 0.

Child Tickets

Change History (2)

comment:1 Changed 23 months ago by dgoulet

Status: assignedneeds_review

See branch: bug24161_032_01

comment:2 Changed 23 months ago by nickm

Resolution: fixed
Status: needs_reviewclosed

Merged!

(Assuming that this needs no changes file since it's a bugfix on a recent patch in 0.3.2. Please get me a changes file if not?)

Note: See TracTickets for help on using tickets.