Opened 5 months ago

Closed 5 months ago

#26711 closed defect (fixed)

Missing recent bridge descriptors cause trouble with history file on fresh Onionoo instance

Reported by: karsten Owned by: metrics-team
Priority: High Milestone:
Component: Metrics/Onionoo Version:
Severity: Normal Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

It's been 3 days now that CollecTor provided the last sanitized bridge descriptors, and this means that its recent/ directory is now empty. Apparently, we don't handle this unusual situation very well:

Exception in thread "main" java.lang.IllegalStateException: Operation is not permitted before finishing to read.
	at org.torproject.descriptor.impl.DescriptorReaderImpl.getExcludedFiles(DescriptorReaderImpl.java:68)
	at org.torproject.onionoo.updater.DescriptorQueue.writeHistoryFile(DescriptorQueue.java:113)
	at org.torproject.onionoo.updater.DescriptorSource.writeHistoryFiles(DescriptorSource.java:222)
	at org.torproject.onionoo.cron.Main.shutDown(Main.java:195)
	at org.torproject.onionoo.cron.Main.run(Main.java:130)
	at org.torproject.onionoo.cron.Main.runOrScheduleExecutions(Main.java:102)
	at org.torproject.onionoo.cron.Main.main(Main.java:34)

Working hotfix:

diff --git a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
index c19fabd..0f3e9e7 100644
--- a/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
+++ b/src/main/java/org/torproject/onionoo/updater/DescriptorQueue.java
@@ -108,6 +108,11 @@ class DescriptorQueue {
     if (this.historyFile == null) {
       return;
     }
+    if (null == this.descriptors) {
+      log.warn("Not writing history file {}, because we did not read a single "
+          + "descriptor from {}.", this.historyFile, this.directory);
+      return;
+    }
     SortedMap<String, Long> excludedAndParsedFiles = new TreeMap<>();
     excludedAndParsedFiles.putAll(
         this.descriptorReader.getExcludedFiles());

Log output:

2018-07-09 19:41:28,344 DEBUG o.t.o.u.DescriptorSource:220 Writing parse histories for recent descriptors...
2018-07-09 19:41:28,347 WARN o.t.o.u.DescriptorQueue:112 Not writing history file status/collector.torproject.org/bridge-server-hi
story, because we did not read a single descriptor from status/collector.torproject.org/recent/bridge-descriptors/server-descripto
rs.
2018-07-09 19:41:28,347 WARN o.t.o.u.DescriptorQueue:112 Not writing history file status/collector.torproject.org/bridge-extrainfo
-history, because we did not read a single descriptor from status/collector.torproject.org/recent/bridge-descriptors/extra-infos.
2018-07-09 19:41:28,347 WARN o.t.o.u.DescriptorQueue:112 Not writing history file status/collector.torproject.org/bridge-status-hi
story, because we did not read a single descriptor from status/collector.torproject.org/recent/bridge-descriptors/statuses.
2018-07-09 19:41:28,347 INFO o.t.o.cron.Main:196 Wrote parse histories

Let's look more into this and possibly finding a better fix as long as the situation exists that we don't have recent bridge descriptors from CollecTor.

Child Tickets

Change History (3)

comment:1 Changed 5 months ago by karsten

Status: newneeds_review

In fact, the hotfix works pretty well. I changed the warning to a debug message and pushed the patch as commit 83dfdd2 to my task-26711 branch. Please take a look!

comment:2 Changed 5 months ago by irl

Status: needs_reviewmerge_ready

Looks good to me. (:

comment:3 Changed 5 months ago by karsten

Resolution: fixed
Status: merge_readyclosed

Thanks for reviewing! Cherry-picked to master and pushed. Closing.

Note: See TracTickets for help on using tickets.