go-haproxy icon indicating copy to clipboard operation
go-haproxy copied to clipboard

Added deadline timeout for socket operations (avoid deadlocks)

Open vponomarev opened this issue 2 years ago • 0 comments

Current implementation will be blocked forever in case if haproxy (or someone else, opened this socket) will not generate any answer and will not close socket.

So, the fix is:

  1. Presented new parameter TimeoutOp for operation timeout (separate from Timeout, used for connection timeout), now it will be possible to set Timeout = 10 (10 sec for connection) and TimeoutOp = 2 (2 sec for processing request).
  2. Added SetDeadline for connection

I tested with fake haproxy running by: socat - UNIX-LISTEN:./var/run/haproxy.sock

Old implementation was blocked, new implementation returned after timeout: read unix ->/var/run/haproxy.sock: i/o timeout

vponomarev avatar Jul 07 '23 21:07 vponomarev