I'm trying to understand what the typical behavior for the following scenario. Please note I'm open to finding out more about this edge case for any OS (*nix, Windows, ...).
If an application is blocked waiting or a lingering socket to close, what happens when the machine is rebooted?
Consider the following example scenario:
An application has an established TCP socket, and then calls close() on the socket. The socket is configured to linger (SO_LINGER) for say, 10 seconds.
Due to the linger setting, the application blocks, waiting for (up to) the 10 second linger time to TX/RX/ACK remaining data on the connection.
During this time, the kernel is rebooted (e.g. user reboots the machine).
What does the kernel do in such a case?
Does it force the socket to close ("abortive close")? Causing any unsent/un-ACK'd data to be lost?
Or does it respect the linger time and wait for the (possibly) full 10 seconds? (Thus blocking the reboot, possibly until the full 10 second linger time has expired).
Something else?
Thanks,
Steve