Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turning off TCP keepalive does not work on bypassed sockets when no activity is performed #52

Open
vient opened this issue Oct 12, 2021 · 0 comments

Comments

@vient
Copy link

vient commented Oct 12, 2021

Expectation: setting SO_KEEPALIVE to 0 on socket turns off keepalive logic.

Reality: setting SO_KEEPALIVE to 0 on socket zeroes out userspace keepalive variables but does not zero out kernel keepalive timer. When time of next keepalive packet comes, no "is keepalive enabled" check is performed.

https://github.com/exablaze-oss/exanic-software/blob/404da33717db8029557eb884fb1285f7c43bc75e/modules/exasock/exasock-tcp.c#L2966-L2989

state->p.tcp.keepalive.probes is zero so tcp->keepalive.probe_cnt < state->p.tcp.keepalive.probes check is never passed. As a result, keepalive is not turned off; on the contrary, socket is invariably closed with ETIMEDOUT when timer goes to zero.


I fixed it for myself by changing line
https://github.com/exablaze-oss/exanic-software/blob/404da33717db8029557eb884fb1285f7c43bc75e/modules/exasock/exasock-tcp.c#L2970
to

if (tcp->keepalive.timer == 0 && state->p.tcp.keepalive.probes);

but I'm not sure if that's the best way to do so.

@vient vient changed the title Turning off TCP keepalive does not work for bypassed sockets Turning off TCP keepalive does not work on bypassed sockets Oct 12, 2021
@vient vient changed the title Turning off TCP keepalive does not work on bypassed sockets Turning off TCP keepalive does not work on bypassed sockets when no activity is performed Oct 13, 2021
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

No branches or pull requests

1 participant