Repository navigation
v2.0.1 - TCP Race Condition Fix
π Bug Fixes
This release fixes a critical race condition in TCP connection handling that caused use of closed network connection errors in production environments, particularly with HTTP/2.0 queries.
What was fixed?
TCP Race Condition (#1)
- Fixed race condition where TCP connections were closed while query processing goroutines were still running
- Added
sync.WaitGroupsynchronization to ensure all in-flight queries complete before connection closure - Prevents "write tcp: use of closed network connection" errors seen in production logs
Technical Details
The issue occurred when:
- Client sent a DNS query over TCP
- Query processing started asynchronously in a goroutine
- Client disconnected or connection timed out
- Connection was closed immediately
- Goroutine tried to write response to closed connection β error
The fix ensures graceful shutdown by waiting for all query processing to complete before closing the connection.
Testing
- Added comprehensive TCP connection tests (
proxy/tcp_test.go) - All tests pass with race detector enabled (
-race) - Verified fix prevents connection errors under concurrent load
π¦ Installation
Linux (arm64)
wget https://github.com/mojo333/nextdns/releases/download/v2.0.1/nextdns_2.0.1_linux_arm64.tar.gz
tar xzf nextdns_2.0.1_linux_arm64.tar.gz
sudo mv nextdns /usr/bin/Other Platforms
Download the appropriate archive for your platform from the assets below.
π Checksums
See SHA256SUMS in the release assets for file integrity verification.
Full Changelog: v2.0.0...v2.0.1