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

KILL USER <user> checks a session's current user, not its login

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.4.10
    • None
    • Server
    • None

    Description

      I recently had an issue where I couldn't identify for absolutely sure which session was a user's because it was stuck in a trigger, and showing the role name that the trigger runs under while causing a backlog of other sessions in that same trigger.

      I tried KILL USER <user> and it didn't kill the session that was causing the problem.

      • KILL USER checks a session's current user, not its login. Its matching code (kill_threads_callback in sql_parse.cc) compares against thd->security_ctx->user and host_or_ip. That is the current security context, not main_security_ctx, the one set at login.
      • Triggers swap that current user. sp_head::execute_trigger calls change_security_context, so for as long as trigger code is running the session's user and host are the trigger's definer. SHOW PROCESSLIST reads the same field, which is why oncillaRoutine appears there. The definer's host is empty, which explains the bare :port. (talking about a screenshot showing the role name of the DEFINER)

      The user shown in processlist and the user that KILL USER <user> checks against should probably be consistent.

      Attachments

        Activity

          People

            Unassigned Unassigned
            psumner Phil Sumner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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