use TCP keepalive for CockroachDB connections - #11083
Conversation
|
Unfortunately, there's no great way to automatically test this. Diesel doesn't expose the fd it uses for its connections, so there's no way for the program itself to inspect the socket and see its TCP keepalive settings. The only way I can think to do this is some platform-specific and either complex or unstable way to enumerate all fds to find ours (e.g., parse What I did do is verify this by hand as follows. First, I ran: Note that CockroachDB is listening on port 55908. I use this below. I found the process with then I used I put the vnodes (the addresses in column 3) into a file: and piped that back into Let's see those values in decimal: Finally, what are those fields? and from and per tcp(4p):
So:
|
|
For completeness, I did the same test without my change and found: As expected: without this, the first packet is not sent for 7200 seconds, or two hours. Then it's another 8 minutes before the connection is terminated. |
rmustacc
left a comment
There was a problem hiding this comment.
I spent some time chasing down that these ultimately are libpq settings and the semantics make sense and match the bits you found in the kernel. It may make sense to try and use ipd or similar to drop traffic so we can see that the timeout actually happens. I assume the rest of the stack from diesel through bb8 deal and handle with what I assume is eventually a POLLHUP/POLLERR on the socket.
Fixes #10668. The tunables here configure connections to be closed in about 60 seconds.