Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
Trac
Trac
  • Project overview
    • Project overview
    • Details
    • Activity
  • Issues 246
    • Issues 246
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value Stream
  • Wiki
    • Wiki
  • Members
    • Members
  • Activity
  • Create a new issue
  • Issue Boards
Collapse sidebar

GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

  • Legacy
  • TracTrac
  • Issues
  • #20224

Closed (moved)
Open
Opened Sep 23, 2016 by Karsten Loesing@karsten

Fix `BridgeDescriptorMappingsLimit` config option

The BridgeDescriptorMappingsLimit option doesn't work as expected with its default value inf or with other sufficiently large values. Here's where that configuration value is used (https://gitweb.torproject.org/collector.git/tree/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java#n183):

      this.bridgeSanitizingCutOffTimestamp = formatter.format(
          System.currentTimeMillis() - 24L * 60L * 60L * 1000L
          * limitBridgeSanitizingInterval);

For limitBridgeSanitizingInterval = Integer.MAX_VALUE, we'd try to format 1474617184667 - 86400000 * 2147483647 = -1.855E+017 milliseconds since the epoch. In theory, that large negative value should still fit into the long, but somehow it gets formatted as 5877475-11-25 07:53:04, which is in the future rather than in the past.

Anyway, I stopped digging what the exact bug might be, and instead suggest this possible fix:

diff --git a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
index b61cd30..b8674a3 100644
--- a/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
+++ b/src/main/java/org/torproject/collector/bridgedescs/SanitizedBridgesWriter.java
@@ -180,9 +180,9 @@ public class SanitizedBridgesWriter extends CollecTorMain {
       SimpleDateFormat formatter = new SimpleDateFormat(
           "yyyy-MM-dd HH:mm:ss");
       formatter.setTimeZone(TimeZone.getTimeZone("UTC"));
-      this.bridgeSanitizingCutOffTimestamp = formatter.format(
+      this.bridgeSanitizingCutOffTimestamp = formatter.format(Math.max(-1L,
           System.currentTimeMillis() - 24L * 60L * 60L * 1000L
-          * limitBridgeSanitizingInterval);
+          * limitBridgeSanitizingInterval));
     } else {
       this.bridgeSanitizingCutOffTimestamp = "1999-12-31 23:59:59";
     }
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
CollecTor 1.7.0
Milestone
CollecTor 1.7.0
Assign milestone
Time tracking
None
Due date
None
Reference: legacy/trac#20224