You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sporadic 502: ReadHeaderTimeout set to 10 microseconds instead of seconds #9
Intermittent 502 responses from the notes API behind a reverse proxy, with the proxy logging:
recv() failed (104: Connection reset by peer) while reading response header from upstream
Root cause
The HTTP server was configured with:
ReadHeaderTimeout: 10*1024
An untyped constant assigned to a time.Duration field is interpreted in nanoseconds, so the effective timeout was 10.24 microseconds instead of the intended 10 seconds. Any request whose headers took longer than that to arrive (second TCP segment, scheduling hiccup) got its connection killed by the server, which the proxy surfaces as a 502.
Fix
Set proper timeouts: ReadHeaderTimeout: 10 * time.Second, plus ReadTimeout/WriteTimeout 30s and IdleTimeout 120s.
Verified by hammering the public endpoint with 40 concurrent requests: all clean responses, no resets (previously the reset reproduced under bursts).
Activity