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

innodb_encryption_threads=0 hangs indefinitely when rotation IOPS is zero

    XMLWordPrintable

Details

    • Bug
    • Status: Stalled (View Workflow)
    • Major
    • Resolution: Unresolved
    • 13.1, 10.11.19, 11.4.13, 11.8.9, 12.3.3
    • 10.11, 11.4, 11.8, 12.3, 13.0

    Description

      When an InnoDB encryption worker has pending default-encryption work and
      `innodb_encryption_rotation_iops` is zero, setting
      `innodb_encryption_threads=0` does not finish. The client remains in the
      statement while the server continues to answer other connections.

      Steps to reproduce

      IMAGE='mariadb@sha256:dd9b303aed4f4890ed09f766d8ca9ddfd176c0c6f6267feff53b3192ec65a979'
      C='mdev-encryption-worker-repro'
      D=$(mktemp -d)
      cleanup() {
        docker rm -f "$C" >/dev/null 2>&1 || true
        rm -r "$D" >/dev/null 2>&1 || true
      }
      trap cleanup EXIT
      printf '%s\n' '1;11111111111111111111111111111111' > "$D/keys.txt"
      chmod 0644 "$D/keys.txt"
       
      docker run --detach --name "$C" \
        --mount type=bind,src="$D/keys.txt",dst=/keys.txt,readonly \
        --env MARIADB_ALLOW_EMPTY_ROOT_PASSWORD=1 \
        "$IMAGE" \
        --plugin-load-add=file_key_management.so \
        --file-key-management-filename=/keys.txt
       
      for i in $(seq 1 90); do
        if docker exec "$C" mariadb --protocol=socket -uroot -NBe \
             "SELECT @@port" 2>/dev/null | grep -qx 3306; then
          break
        fi
        sleep 1
      done
       
      docker exec "$C" mariadb --protocol=socket -uroot -e "
        SELECT PLUGIN_STATUS
          FROM INFORMATION_SCHEMA.PLUGINS
         WHERE PLUGIN_NAME='file_key_management';
        SET GLOBAL innodb_encrypt_tables='OFF';
        CREATE DATABASE crypt_scope;
        CREATE TABLE crypt_scope.t4(
          id INT PRIMARY KEY,
          pad VARCHAR(4096)
        ) ENGINE=InnoDB ENCRYPTED=NO;
        INSERT INTO crypt_scope.t4
          SELECT seq, REPEAT('x',4000) FROM seq_1_to_10000;
        FLUSH TABLES crypt_scope.t4;
        SET GLOBAL innodb_encryption_threads=1;
        SET GLOBAL innodb_encryption_rotation_iops=0;
        SET GLOBAL innodb_encrypt_tables='ON';
        DO SLEEP(2);
      "
       
      # This statement should return promptly, but it remains blocked.
      timeout 8 docker exec "$C" mariadb --protocol=socket -uroot -e \
        "SET GLOBAL innodb_encryption_threads=0"
      echo "shutdown_statement_rc=$?"
       
      sleep 20
      docker exec "$C" mariadb --protocol=socket -uroot -e "SHOW FULL PROCESSLIST"
      docker exec "$C" mariadb-admin --protocol=socket -uroot ping
      
      

      For comparison, repeat the test with
      `innodb_encryption_rotation_iops=100`; the final `SET GLOBAL` returns normally.

      Actual result

      In the reproduced 12.3.3 run, the zero-IOPS case exceeded the 8-second bound:

      shutdown_statement_rc=124
      

      `SHOW FULL PROCESSLIST` still showed
      `SET GLOBAL innodb_encryption_threads=0` after 29 seconds. At the same time:

      mysqld is alive
      

      The `rotation_iops=100` control completed within the same 8-second bound.

      Expected result

      Setting `innodb_encryption_threads=0` should stop the worker and return in
      bounded time even when the configured rotation IOPS value is zero. It should
      not require another session to change the IOPS value or a server restart.

      Impact and boundary

      An administrator can leave the configuration statement and encryption worker
      shutdown indefinitely blocked. The server process itself did not crash and
      continued to answer health checks. Only MariaDB 12.3.3 was tested. This report
      is researcher-reproduced and not yet maintainer-confirmed.

      Attachments

        1. mdev-41055.opt
          0.1 kB
          Shipra Jain
        2. mdev-41055.test
          1 kB
          Shipra Jain

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              csfuzz csfuzz
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.25h Remaining Estimate - 1d 3.75h
                  1d 3.75h
                  Logged:
                  Time Spent - 0.25h Remaining Estimate - 1d 3.75h
                  0.25h

                  Git Integration

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