Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-23348

vio_shutdown does not prevent later ReadFile on named pipe.

    XMLWordPrintable

Details

    Description

      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.

      Attachments

        Activity

          People

            wlad Vladislav Vaintroub
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.