[tor-bugs] #19720 [Metrics/CollecTor]: CollecTor should be re-configurable without restart

Tor Bug Tracker & Wiki blackhole at torproject.org
Thu Aug 4 12:25:58 UTC 2016


#19720: CollecTor should be re-configurable without restart
-------------------------------+---------------------------------
 Reporter:  iwakeh             |          Owner:  iwakeh
     Type:  enhancement        |         Status:  needs_review
 Priority:  Medium             |      Milestone:  CollecTor 1.0.0
Component:  Metrics/CollecTor  |        Version:
 Severity:  Normal             |     Resolution:
 Keywords:  ctip               |  Actual Points:
Parent ID:                     |         Points:
 Reviewer:                     |        Sponsor:
-------------------------------+---------------------------------

Comment (by iwakeh):

 Replying to [comment:5 karsten]:
 > I read through the changes and would like to read them once more, but
 before I do that: can you specify exactly what happens when the
 configuration changes?

 Good point.  Below I add a description of the process.

 >  - Do changes affect a currently running module execution, or are they
 only read at the beginning of the next execution?

 No, the changes will be read at the next execution.

 >  - Does it take up to 1 minute for changes to become effective, or do
 they become effective immediately?

 When a module starts (see below).

 >  - Are changes that enable or disable modules or that change scheduling
 of modules ignored entirely, or is it harmful to even touch them?

 They're ignored as the Scheduler only uses the initial properties once.


 == Design of the Configuration Update

 Changes to existing classes:
 * The `Configuration` class is now an Observable and has Properties.
 * All `CollecTorMain`s use their own copy of the initial configuration and
 register as `Observers`.
 * `Main`now calls `newConfigAvailable` for setting the configuration.

 `Configuration` begins to look at the modified time of the configuration
 file given as argument of `setWatchableSourceAndLoad`, i.e. a scheduled
 thread (currently every minute, which is usefully small, but an arbitrary
 choice) checks, if the file was modified.  If it was modified, the
 properties held in 'Configuration' are cleared (`CollecTorMain`s have
 their own copy each, they are not affected by this) and re-loaded from the
 file. If the loading succeeds, all `Observer`s are informed.

 `CollecTorMain` implements the update method of `Observer`. When this
 method is called, `newConfigAvailable` is set to true. In the `run` method
 this variable is checked and the new configuration is copied and used in
 this run and until a new configuration is available.


 ----

 An unrelated change:  I made Scheduler 'final' as it should not be
 extended.

--
Ticket URL: <https://trac.torproject.org/projects/tor/ticket/19720#comment:6>
Tor Bug Tracker & Wiki <https://trac.torproject.org/>
The Tor Project: anonymity online


More information about the tor-bugs mailing list