3 ms·
How do things like this handle sockets? Is there some kind of first class event that the app can detect, or does it just "close" them all and assume the app can
by whartung 2y ago
How do things like this handle sockets? Is there some kind of first class event that the app can detect, or does it just "close" them all and assume the app can cleanly reconnect to reestablish them (once they detect that the socket has rudely closed on them)?
- loeg 2y agohttps://github.com/checkpoint-restore/criu?tab=readme-ov-file#tcp-sockets-checkpoint-restore https://github.com/checkpoint-restore/criu?tab=readme-ov-fil... > One of the CRIU features is the ability to save and restore state of a TCP socket without breaking the connection. This functionality is considered to be useful by itself, and we have it available as the libsoccr library.
- touisteur 2y agoThere are many ways to go about it. Standard way recommended with libsoccr (the criu library to handle tcp socket checkpoint/restore) is to install a firewall rule to filter packets during checkpoint and let tcp resend whatever it needs to resync whenever the socket is restored. If you want your original process to continue living after the checkpoint and not lose packets during checkpoint, you can go a pretty long way with the 'plug' tc, IFBs. And if you're aventurous, lots of support for getsockopt/setsockopt and ioctls have been or are being merged within io_uring so checkpointing a big-buffered TCP socket can cost under 100us, even less IIRC.