Skip to content

Added deadline timeout for socket operations (avoid deadlocks)#12

Open
vponomarev wants to merge 2 commits intobcicen:masterfrom
vponomarev:master
Open

Added deadline timeout for socket operations (avoid deadlocks)#12
vponomarev wants to merge 2 commits intobcicen:masterfrom
vponomarev:master

Conversation

@vponomarev
Copy link
Copy Markdown

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

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.

1 participant