Opened 16 months ago

Closed 14 months ago

Last modified 14 months ago

#25375 closed defect (implemented)

Remove as many items as possible from second_elapsed_callback() and run_scheduled_events()

Reported by: nickm Owned by: nickm
Priority: Medium Milestone: Tor: 0.3.4.x-final
Component: Core Tor/Tor Version:
Severity: Normal Keywords: 034-roadmap-subtask, 034-triage-20180328, 034-included-20180328
Cc: Actual Points:
Parent ID: #25500 Points:
Reviewer: Sponsor: Sponsor8

Description

We have a real system for periodic events and deferred events and so on -- several of them, in fact. We shouldn't be using second_elapsed_callback() and run_scheduled_events() to do things any more:

  • Some things should be done as soon as possible, on demand (see #25374).
  • Some things should be done on the timers from periodic.c.
  • Some things should be done with one-off timers schedueld "for later".

And some things might still need to be done once a second -- but they should be things that only need to happen when Tor is running. When Tor is idle or hibernating, or when DisableNetwork is set, we should be able to disable those once-per-second events so that we don't use so much CPU.

Please make subtickets for removing things from these functions.

Child Tickets

TicketStatusOwnerSummaryComponent
#25927closednickmRemove the need for gettimeofday_cached(); use monotonic time in ewma codeCore Tor/Tor
#25931closednickmMove consdiffmgr_rescan() into its own callbackCore Tor/Tor
#25932closednickmClose closeable objects in a postloop event, not in second_elapsed_callback().Core Tor/Tor
#25933closednickmRemove connection_ap_attach_pending(0) from per-second callback.Core Tor/Tor
#25937closednickmMove dirvote_act into a periodic callbackCore Tor/Tor
#25948closednickmRun or_state_save as a mainloop eventCore Tor/Tor
#25949closednickmHandle deferred SIGNEWNYM requests with a mainloop eventCore Tor/Tor
#25951closednickmRun flush_pending_log_callbacks() on an as-needed basis, not once-per-secondCore Tor/Tor
#25952closednickmMove check_whether_*port_reachable() to a scheduled callback, not once-per-secondCore Tor/Tor
#26009closednickmRemove management of approx_time() from second_elapsed_callbackCore Tor/Tor
#26016closednickmReplace n_libevent_errors logic with a rate-limiter.Core Tor/Tor
#26064closednickmUse a mainloop timer to wake up from hibernation.Core Tor/Tor

Change History (8)

comment:1 Changed 16 months ago by dgoulet

Parent ID: #25500

Setting master ticket parent ID.

comment:2 Changed 15 months ago by dgoulet

Owner: set to dgoulet
Status: newaccepted

comment:3 Changed 15 months ago by nickm

Keywords: 034-roadmap-subtask added

comment:4 Changed 15 months ago by nickm

Keywords: 034-triage-20180328 added

comment:5 Changed 15 months ago by nickm

Keywords: 034-included-20180328 added

comment:6 Changed 14 months ago by nickm

Owner: changed from dgoulet to nickm
Status: acceptedassigned

comment:7 Changed 14 months ago by nickm

Resolution: implemented
Status: assignedclosed

I'm going to call this done for 0.3.4. We could still remove more things, but we got all the stuff that would prevent us from doing #26063 and saving CPU.

comment:8 Changed 14 months ago by nickm

I've opened #26070 to cover the remaining cases here.

Note: See TracTickets for help on using tickets.