htpdate fails when reconnecting to the network due to its startup being racy vs. Tor Connection restarting tor
When we have already connected to Tor, then disconnected from the network and we're now reconnecting, this can happen:
- In
10-tor.sh
, we restart tor, Tor Connection, andhtpdate.service
. The latter waits for tor to have bootstrapped before actually startinghtpdate
. - Since
DisableNetwork
is not set anymore, tor bootstraps immediately and very quickly - This creates the flag file that
htpdate.service
was waiting for, so it startshtpdate
. - Tor Connection sets the clock from the network, then restarts tor, which breaks htpdate.
In our test suite, this results in "Scenario The same Tor configuration is applied when the network is reconnected" failing at step "And I wait until Tor is ready" with Time syncing failed (HtpdateError)
.
We don't see it elsewhere in our test suite because we don't usually reconnect to a network. But I suspect users could see this more often.
My understanding of !558 (merged) (that closed #18517 (closed)) suggests this might affect tails-additional-software-upgrade.service
as well, if it's also started a bit too early.
Originally spotted on !1676 (comment 243078).