Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-171

Release connection to pool undoes last commit

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Incomplete
    • 2.5.4
    • N/A
    • execute
    • MariaDB Database: 10.5
      MariaDB Package: 2.5.4
      NodeJS: 14 and 15
      OS: Debian and Ubuntu

    Description

      In our application, we get a connection from the pool, start a transaction, add a few records and commit them. After the commit, we release the connection. It looks like releasing the connection sporadically undoes the commit.

      Our script (reduced to interactions with mariadb):

      const conn = await pool.getConnection();
      await conn.beginTransaction();
       
      // insert rows
      const res = await conn.query('XXX');
      if(res.affectedRows < 1) throw new Error('insert failed');
       
      await conn.commit();
      await conn.release();
      

      If we run this multiple times we missed about 1 of 5 transactions. If we set noControlAfterUse in the pool configuration, all transactions are committed correctly.

      With the debug log enabled, you can see that RESET statement is sent first before the COMMIT statement.

      ==> conn:1105470 Reset(0,5)
      +--------------------------------------------------+
      |  0  1  2  3  4  5  6  7   8  9  a  b  c  d  e  f |
      +--------------------------------------------------+------------------+
      | 01 00 00 00 1F                                   | .....            |
      +--------------------------------------------------+------------------+
       
      ==> conn:1105470 Query(0,11)
      +--------------------------------------------------+
      |  0  1  2  3  4  5  6  7   8  9  a  b  c  d  e  f |
      +--------------------------------------------------+------------------+
      | 07 00 00 00 03 43 4F 4D  4D 49 54                | .....COMMIT      |
      +--------------------------------------------------+------------------+
      

      I created a GitHub issue too, see https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/164

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            BC-M Malte Bastian
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.