-
-
Notifications
You must be signed in to change notification settings - Fork 660
Description
Summary
After upgrading from v1.60.0 to v1.61.0, torrents added via AddTorrentSpec never receive metadata when TrackerDialContext is configured to route tracker connections through an HTTP CONNECT proxy. The torrent sits at 0 peers for the entire duration until timeout. Downgrading back to v1.60.0 (via replace directive) immediately fixes the issue — same magnets, same proxy, same config.
Environment
- Go 1.24.5, macOS (darwin)
- HTTP CONNECT proxy (NordVPN HTTPS proxy on port 89)
TrackerDialContextset to a custom proxy dialer- DHT disabled (
NoDHT: true), uTP disabled (DisableUTP: true), PEX disabled (DisablePEX: true) - Only TCP peer connections through proxy dialer (
client.AddDialer)
Client Config
cfg := torrent.NewDefaultClientConfig()
cfg.Seed = true
cfg.DisableIPv6 = true
cfg.TrackerDialContext = proxyDialer.DialContext
cfg.HTTPDialContext = proxyDialer.DialContext
cfg.DialForPeerConns = false
cfg.NoDHT = true
cfg.DisableUTP = true
cfg.DisablePEX = true
cfg.AcceptPeerConnections = false
cfg.NoDefaultPortForwarding = true
cfg.DisableAcceptRateLimiting = true
cfg.DisableTCP = false
client.AddDialer(dialer.WithNetwork{
Network: "tcp4",
Dialer: proxyDialer,
})Reproduction
- Create a torrent client with the config above (proxy + disabled UDP/DHT/PEX)
- Add a well-seeded torrent via
AddTorrentSpec - Wait for
GotInfo()— v1.60.0: resolves in ~2s with peers. v1.61.0: never resolves, 0 peers throughout
Observed Behavior
t.Stats()showsTotalPeers=0, ActivePeers=0, ConnectedSeeders=0for the entire 60s wait- The torrent has standard UDP trackers (e.g.,
udp://tracker.opentrackr.org:1337/announce) - These same magnets with the same proxy config download successfully on v1.60.0
Root Cause (suspected)
The client-trackers branch merged in v1.61.0 replaced per-torrent trackerScraper goroutines with a centralized regularTrackerAnnounceDispatcher. The old trackerScraper.Run() would immediately start announcing to trackers using TrackerDialContext. The new dispatcher uses timer-based scheduling that appears to either:
- Not trigger the first announce quickly enough (or at all) for proxy-routed connections
- Have an issue with the announce dispatch loop when
TrackerDialContextis set
The TrackerDialContext config field is still passed through to initTrackerClient → tracker.NewClientOpts, so the plumbing exists — but the scheduling/dispatch layer seems to not actually fire announces in time.
Workaround
Pin to v1.60.0 via replace directive in go.mod:
replace github.com/anacrolix/torrent => github.com/anacrolix/torrent v1.60.0