[tor-bugs] #16296 [Onionoo]: Implement lock file in a more robust way

Tor Bug Tracker & Wiki blackhole at torproject.org
Sat Jul 11 06:41:18 UTC 2015


#16296: Implement lock file in a more robust way
-------------------------+--------------------------
     Reporter:  karsten  |      Owner:
         Type:  defect   |     Status:  needs_review
     Priority:  normal   |  Milestone:
    Component:  Onionoo  |    Version:
   Resolution:           |   Keywords:
Actual Points:           |  Parent ID:
       Points:           |
-------------------------+--------------------------

Comment (by karsten):

 Sorry again for throwing in something here that doesn't address most of
 your comments, but I figured it's better to note this than stay silent:

 I noticed that we try hard in `NodeDetailsStatusUpdater` not to have
 `DocumentStore` read `NodeStatus` instances from disk until after we
 finished parsing new descriptors in
 `NodeDetailsStatusUpdater.processDescriptor` and before
 `NodeDetailsStatusUpdater.readNodeStatuses` is called.  And that works
 fine for the `--single-run` case.  But it fails for the no-args execution
 of the hourly updater, because in that case `DocumentStore` will just keep
 `NodeStatus` instances in memory until the next run starts.  What we
 should do, I think, is invalidate the cache after each hourly update.  I
 think the following code achieves that, but I'd appreciate another set of
 eyes to look and another set of hands to test before merging this.
 Thanks!

 {{{
 diff --git a/src/main/java/org/torproject/onionoo/cron/Main.java
 b/src/main/java/org/torproject/onionoo/cron/Main.java
 index 6f39cb6..d8739e1 100644
 --- a/src/main/java/org/torproject/onionoo/cron/Main.java
 +++ b/src/main/java/org/torproject/onionoo/cron/Main.java
 @@ -204,6 +204,8 @@ public class Main implements Runnable {
      if (this.ds != null) {
        this.ds.flushDocumentCache();
        this.log.info("Flushed document cache");
 +      this.ds.invalidateDocumentCache();
 +      this.log.info("Invalidated document cache");
      }
    }
 }}}

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


More information about the tor-bugs mailing list