Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

When tracker hosts are automatically updated via HostsDownloadWorker, the ServiceSinkhole.mapHostsBlocked map is reloaded but the TrackerList singleton's internal data structures (hostnameToTracker and trackingIps) remain stale. This causes incorrect tracker identification after automatic updates.

Changes

TrackerList.java

  • Added reloadTrackerData() static method to clear and reload tracker data atomically
  • Changed trackingIps from HashSet to ConcurrentHashMap.newKeySet() for thread safety
  • Added reloadLock to synchronize clear-and-reload operations

ServiceSinkhole.java

  • Call TrackerList.reloadTrackerData() in prepareHostsBlocked() after reloading hosts

ActivitySettings.java

  • Use reloadTrackerData() instead of loadTrackers() when domain_based_blocked changes to properly clear old data

Example

When hosts are updated:

// Before: TrackerList singleton retains stale data
prepareHostsBlocked(c);  // Only reloads mapHostsBlocked

// After: TrackerList reloads in sync
prepareHostsBlocked(c);  // Reloads both mapHostsBlocked and TrackerList

Thread safety is maintained through synchronized reload and concurrent collections.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4608m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Updating tracker hosts automatically</issue_title>
<issue_description>The latest updates update some of the tracker hosts automatically. Does the TrackerList actually reload properly after this, since this is used for checking traffic in ServiceSinkhole?</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 7, 2026 16:04
- Add reloadTrackerData() method to TrackerList to clear and reload tracker data
- Change trackingIps from HashSet to ConcurrentHashMap.newKeySet() for thread safety
- Call reloadTrackerData() from prepareHostsBlocked() after hosts are reloaded
- Invalidate tracker count cache when tracker data is reloaded
- Ensures TrackerList stays in sync with updated hosts from automatic downloads

Co-authored-by: kasnder <[email protected]>
- Use getInstance(c) in reloadTrackerData() to ensure instance is created
- Fix ActivitySettings to use reloadTrackerData() instead of loadTrackers()
  to properly clear old data when domain_based_blocked setting changes

Co-authored-by: kasnder <[email protected]>
- Add reloadLock to synchronize tracker data reload operations
- Wrap entire reload operation in synchronized block to prevent race conditions
- Ensures atomic clear and reload of tracker data

Co-authored-by: kasnder <[email protected]>
Copilot AI changed the title [WIP] Fix tracker list reload after automatic host updates Reload TrackerList when hosts are automatically updated Jan 7, 2026
Copilot AI requested a review from kasnder January 7, 2026 16:13
@kasnder kasnder marked this pull request as ready for review January 8, 2026 10:02
@kasnder kasnder merged commit 447c6dc into master Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Updating tracker hosts automatically

2 participants