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

Query Cache Corruption

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5.13
    • 10.5, 10.6
    • Query Cache
    • None
    • Rocky Linux 8.4, php 7.3, perl 5.26.3, mariadb 10.5.9

    Description

      When I connect to mariadb with different clients, cached query results are sometimes returned in the wrong format.

      I have a mariadb 10.5.9 database, with the following clients connecting to it:

      1. A php client that connects with an old mysqli driver. It sets client capability flags 0x1AA284 and charset latin1

      2. A perl client that connects DBD::Mysql (using libmariadb 3.1.11 under the hood). It sets client capability flags 0xD00BFA20C and charset latin1

      3. The mysql command line client that comes with Rocky mariadb package (statically compiled with libmariadb 3.1.12). It sets client capability flags 0xD00BFA20E and charset utf8.

      If I run the same query in all 3 clients in the above order, php succeeds, perl gets "Unknown Error", and cli succeeds. After I do "FLUSH TABLES", perl client works fine.

      It appears the query cache needs to key off the MARIADB_CLIENT_EXTENDED_METADATA flag. I believe the command line client succeeds because it connects with a different charset.

      I have also tested with mariadb 10.5.13 RPM downloaded from mariadb.org.

      Setting query_cache_size = 0 in my.cnf works around the issue.

      How to reproduce:

      create database test;
      use test;
      create table Configuration (Name varchar(255), Value varchar(255));
      insert into Configuration values ('n', 'v');
      

      In php:

      <?php
      $dbh = mysqli_init();
      $dbh->real_connect("localhost");
      $dbh->select_db("test");
      $dbh->query("SELECT * FROM Configuration");
      ?>
      

      Then in perl:

      use DBI();
      my $s = "DBI:mysql:database=test;mysql_multi_statements=1;mysql_local_infile=0";
      my $h = DBI->connect($s) || die $DBI::errstr;
      $h->selectall_hashref("SELECT * FROM Configuration", 'Name');
      

      Result:

      DBD::mysql::db selectall_hashref failed: Unknown MySQL error at db.pl line 4.

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            chrisheath Chris Heath
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.