Skip to content

Bug: SOCKS5 UDP association packet queue overflows under BitTorrent load (hardcoded buffer=2) #3368

Description

@blixten85

Is this urgent?

No

Description

After the UDP SOCKS5 support was added in #3353, the logs are flooded with:

WARN [socks5] failed routing UDP packet: association packet queue full

This happens constantly when using Gluetun's SOCKS5 proxy with qBittorrent under normal load (hundreds of active torrents doing periodic UDP tracker announces).

Root cause

In internal/socks5/udp_router.go, the per-association channel buffer is hardcoded to 2:

const udpPacketChannelBuffer = 2
association := udpAssociation{
    ...
    packetCh: make(chan *bytes.Buffer, udpPacketChannelBuffer),
}

When the UDP router receives packets faster than forwardClientPackets can drain the channel, packets are dropped with "association packet queue full". With many active torrents each sending periodic UDP tracker announces, this overflows constantly.

Expected behavior

UDP packets should not be silently dropped under normal BitTorrent load. The buffer size should be larger, or backpressure/congestion handling should be implemented.

Suggested fix

Increase udpPacketChannelBuffer to a more appropriate value (e.g. 64 or 256), or make it configurable via the existing SOCKS5 settings.

Environment

  • Gluetun image: qmcgaw/gluetun:latest (built after feat(socks5): UDP proxying #3353 merge, 2026-06-11)
  • VPN provider: ProtonVPN WireGuard
  • Client: qBittorrent (LSIO) with ~477 active torrents
  • Network mode: Gluetun on Docker bridge, qBittorrent on host network connecting via localhost:1080

Logs

WARN [socks5] failed routing UDP packet: association packet queue full
WARN [socks5] failed routing UDP packet: association packet queue full
WARN [socks5] failed routing UDP packet: association packet queue full

(repeated dozens of times per minute)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions