Opened 10 months ago

Closed 9 months ago

Last modified 8 months ago

#28335 closed enhancement (implemented)

Make most periodic events turn themselves off when Tor is dormant, sleeping, etc.

Reported by: nickm Owned by: nickm
Priority: Medium Milestone: Tor: 0.4.0.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: tor-mainloop
Cc: dgoulet, nickm Actual Points: 7
Parent ID: #25500 Points: 10
Reviewer: dgoulet Sponsor: Sponsor8

Description

See #2149 and https://lists.torproject.org/pipermail/tor-dev/2018-November/013529.html for some background here.

Right now we have a bunch of periodic events -- those in ROLE_ALL and those in second_elapsed_callback() -- that are scheduled all the time. Some of them are run even when DisableNetwork is set.

We should change these events as follows: we should make "ROLE_ALL" a real always-on role, and make sure we're always in it. Then we should move (nearly?) all the events out of ROLE_ALL into new roles, including a role that means "active network participant" -- that is, actively building and using circuits on the Tor network.

We should make it so "that active network participant" will turn off after either a long time without client usage, or when the controller tells it to.

We should make sure that every periodic event that remains in ROLE_ALL has a way to turn it off, a very generous and forgiving timeout, or both.

Child Tickets

TicketTypeStatusOwnerSummary
#2149enhancementclosedangelo620new 'extra dormant' mode for people who never use their tor
#28336enhancementclosedSplit ROLE_ALL into new roles and make it always on role
#28337enhancementclosedImplement a way to enable/disable the network participant role
#28338enhancementclosedAudit ROLE_ALL callbacks to either have a way to turn them off or relax them
#28421defectclosednickmMove control_per_second_events() into a separate callback.
#28422enhancementclosednickmAdd a timed "wakeup handler" for hibernation
#28429defectclosednickmMake the new "extra dormant" code configurable
#28430enhancementclosednickmTests for 'extra dormant' code
#28431defectclosedUpdate control spec with items from "extra dormant" code

Change History (18)

comment:1 Changed 10 months ago by nickm

Tracking the work for splitting up the current timeouts at https://pad.riseup.net/p/role-splitting-2-keep

comment:2 Changed 10 months ago by nickm

Milestone: Tor: 0.3.6.x-finalTor: 0.4.0.x-final

Tor 0.3.6.x has been renamed to 0.4.0.x.

comment:3 Changed 10 months ago by nickm

I've been working on a few of these on a branch called "dormant", but it is blocked on a couple of other things.

comment:4 Changed 9 months ago by nickm

Okay -- this isn't _done_, but it's ready for initial review. (See non-closed child tickets for items that we might still want to do.)

The branch is dormant, with PR at https://github.com/torproject/tor/pull/502

comment:5 Changed 9 months ago by nickm

Reviewer: dormant

comment:6 Changed 9 months ago by nickm

Reviewer: dormantdgoulet

comment:7 Changed 9 months ago by dgoulet

Sponsor: Sponsor8
Status: newneeds_revision

Reviewed. Series of questions, no show stopper.

comment:8 Changed 9 months ago by nickm

Status: needs_revisionneeds_review

Tried to answer and/or revise. Also I could use comment on #28430

comment:9 Changed 9 months ago by dgoulet

Keywords: tor-mainloop added
Status: needs_reviewmerge_ready

Ok this is looking pretty good imo. Will require some testing (#28430) but also lets all now use it to hunt down any regressions.

comment:10 Changed 9 months ago by nickm

I think I'm going to try to write the tests and the the configuration options first.

comment:11 in reply to:  10 Changed 9 months ago by dgoulet

Owner: set to nickm
Status: merge_readyassigned

Replying to nickm:

I think I'm going to try to write the tests and the the configuration options first.

Great. I wouldn't mind when you are done to see a fresh branch (squashed) and PR :).

comment:12 Changed 9 months ago by nickm

Status: assignedneeds_review

Okay, I've added some tests (maybe not all!) and written a control-spec update. I think this is ready for a review now?

comment:13 in reply to:  12 Changed 9 months ago by dgoulet

Replying to nickm:

Okay, I've added some tests (maybe not all!) and written a control-spec update. I think this is ready for a review now?

It doesn't seem on the PR ... where is the code?

comment:14 Changed 9 months ago by nickm

Whoops! See branch dormant_v2 with PR at https://github.com/torproject/tor/pull/523

comment:15 Changed 9 months ago by dgoulet

Status: needs_reviewmerge_ready

Ok lgtm! Lets get it upstream and hunt down bugs :).

comment:16 Changed 9 months ago by nickm

Squashed; merging; doing one last set of tests.

comment:17 Changed 9 months ago by nickm

Resolution: implemented
Status: merge_readyclosed

Merged (as dormant_v2_squashed).

comment:18 Changed 8 months ago by nickm

Actual Points: 7

(Points includes children)

Note: See TracTickets for help on using tickets.