Skip to content

Conversation

@benoitc
Copy link
Owner

@benoitc benoitc commented Jan 19, 2026

Summary

  • Fix race condition in socket handoff by making it synchronous - handler blocks until socket ownership transfer completes
  • Increase timeouts for CI reliability (accept: 100ms→500ms, recv/connect: 5s→10s)

Background

Proxy integration tests were occasionally failing on Linux x86_64 OTP-28 CI runners with errors like {connect_proxy_failed, proxy_error} and {socks5_proxy_failed, badarg}.

The root cause was a race condition in socket handoff: the spawned handler process could try to use the socket before gen_tcp:controlling_process completed. The fix ensures the handler blocks until the socket is explicitly sent to it after ownership transfer.

- Fix race condition in socket handoff by making it synchronous:
  - Handler now blocks waiting for socket via message
  - Socket is sent after controlling_process completes
  - This ensures handler never tries to use socket before ownership
    transfer is complete

- Increase timeouts for CI reliability:
  - Accept timeout: 100ms -> 500ms
  - Recv timeouts: 5s -> 10s
  - Connect timeouts: 5s -> 10s
  - Socket handoff wait: 1s -> 10s

These changes address flaky proxy integration tests that occasionally
failed on Linux x86_64 OTP-28 CI runners with errors like
{connect_proxy_failed, proxy_error} and {socks5_proxy_failed, badarg}.
@benoitc benoitc merged commit 7316ae6 into master Jan 19, 2026
5 checks passed
@benoitc benoitc deleted the fix/flaky-proxy-tests branch January 19, 2026 13:17
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.

2 participants