I had a situation where shutdown of the busy server (benchmarks) would hang with named pipe.
A couple of connections, out of several thousands, were not killed, and the server shutdown came to grinding halt.
It looks like post_kill_notification would not always work on named pipes in the same way it works for sockets/TPC. Apparently, the implementation of the vio_shutdown on pipes currently only cancels IOs in progress, while for sockets , shutdown is "sticky", i.e even if there is no currently any IO in progress, the next send() or recv() will fail.
On Windows, it looks like CancelIoEx did not cancel anything (no IO in-flight), and the connection was at the point where it did not check for THD::killed flag anymore, thus post_kill_notification did not prevent connection from starting waiting input from client, with new asynchronous ReadFile.
To fix that, a shutdown flag needs to be introduced inside VIO , and checked at various points of the IO, before ReadFile, and when Before WaitForSingleObject (wait for the async ReadFile to complete) for pending IO. CancelIoEx is still needed in addition to cancel IO that is currently in progress.