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

Race condition between XA COMMIT/ROLLBACK and disconnect

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 5.5(EOL), 10.0(EOL), 10.1(EOL)
    • 10.1.5
    • OTHER
    • None

    Description

      Test case:

      --source include/have_debug_sync.inc
       
      # Note that this test is meaningful only with valgrind.
      let $op= XA COMMIT 'xatest';
      let $i= 2;
      while ($i)
      {
        connect con1, localhost, root;
        connect con2, localhost, root;
       
        connection con1;
        XA START 'xatest';
        XA END 'xatest';
        XA PREPARE 'xatest';
       
        connection con2;
        SET debug_sync='xa_after_search SIGNAL parked WAIT_FOR go';
        send_eval $op;
       
        connection default;
        SET debug_sync='now WAIT_FOR parked';
        disconnect con1;
        disable_query_log;
        echo # Waiting for thread to get deleted;
        while (`SELECT VARIABLE_VALUE!=2 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='max_used_connections'`)
        {
          real_sleep 0.1;
          FLUSH STATUS;
        }
        enable_query_log;
        SET debug_sync='now SIGNAL go';
       
        connection con2;
        --error ER_XAER_NOTA
        reap;
        disconnect con2;
       
        connection default;
        SET debug_sync='RESET';
       
        let $op= XA ROLLBACK 'xatest';
        dec $i;
      }

      Debug sync patch:

      diff --git a/sql/sql_class.cc b/sql/sql_class.cc
      index 3071ba6..5f744d5 100644
      --- a/sql/sql_class.cc
      +++ b/sql/sql_class.cc
      @@ -5312,6 +5312,7 @@ XID_STATE *xid_cache_search(THD *thd, XID *xid)
         if (element)
         {
           lf_hash_search_unpin(thd->xid_hash_pins);
      +    DEBUG_SYNC(current_thd, "xa_after_search");
           return element->m_xid_state;
         }
         return 0;

      Attachments

        Issue Links

          Activity

            People

              svoj Sergey Vojtovich
              svoj Sergey Vojtovich
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.