lkrg-org / lkrg

Linux Kernel Runtime Guard
https://lkrg.org
Other
403 stars 72 forks source link

Logger: Close orphaned connections #319

Open solardiz opened 4 months ago

solardiz commented 4 months ago

Nov 19, 2022

The sender will sometimes detect an issue and reconnect, but the receiver currently has no logic to close the old connection on its end and kill the old child process when this happens.

We should probably enable SO_KEEPALIVE and maybe set Linux-specific TCP_KEEP* to lower values than defaults. We need this at least on the receiving end, and optionally on the sending end.

Alternatively or additionally, our connection-accepting code could be modified to kill old children when a new connection arrives from the same IP address... although we could prefer to postpone that until the Noise handshake succeeds, and that's tricky.

Nov 24, 2022

The sender will sometimes detect an issue and reconnect, but the receiver currently has no logic to close the old connection on its end and kill the old child process when this happens.

It's not exactly that bad - normally, the connection closing does propagate and result in a failed read from the socket. However, when the network path is down for a long time until successful reconnect, the old connection might already be forgotten by the sending system kernel's TCP stack, in which case the receiver would never know it's closed.