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

"Commands out of sync", "Malformed packet" or client hang up on unique key violation

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • None
    • 10.0.5
    • None
    • None

    Description

      The problems started happening from the following revision on 10.0-base-explain-slowquerylog

      revno: 3711
      revision-id: psergey@askmonty.org-20131007132951-lhe4earylf5m2vmp
      message:
        MDEV-3798: EXPLAIN UPDATE/DELETE
        - Add support for EXPLAIN INSERT.

      and are still reproducible on the current tree:

      bzr version-info
      revision-id: psergey@askmonty.org-20131009090746-6zfqg47elbhnquac
      revno: 3715
      branch-nick: 10.0-base-explain-slowquerylog
      BUILD/compile-pentium-debug-max-no-ndb

      The first test case is an extract from federated.federatedx test, slightly modified to work on a single server.

      drop database if exists federated;
      drop table if exists test.t1;
      create database federated;
      create table federated.t1 (a int primary key, b varchar(64))   DEFAULT CHARSET=utf8;
      create table test.t1 (a int primary key, b varchar(64))  ENGINE=FEDERATED connection='mysql://root@127.0.0.1:3306/federated/t1' DEFAULT CHARSET=utf8;
      insert into test.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") on duplicate key update a=a+100;
      select * from t1;

      According to the federated test, the INSERT should fail with ER_DUP_KEY, but on some reason it doesn't:

      MariaDB [test]> insert into test.t1 values (1,"Larry"), (2,"Curly"), (1,"Moe") on duplicate key update a=a+100;
      Query OK, 3 rows affected (0.02 sec)
      Records: 3  Duplicates: 0  Warnings: 0

      And the following SELECT fails with "Commands out of sync":

      MariaDB [test]> select * from t1;
      ERROR 2014 (HY000): Received error: 2014 : Commands out of sync; you can't run this command now

      The second test case is based on a fragment from rpl.rpl_sp:

      drop table if exists t1;
      drop function if exists fn1;
      create table t1 (a int, unique(a));
       
      delimiter |;
      create function fn1(x int)
        returns int
      begin
        insert into t1 values(x),(x);
        return 10;
      end|
      delimiter ;|
       
      do fn1(100);

      The DO command hangs. The processlist does not show any queries in the thread, but the query in the client does not finish.

      If it is replaced with SELECT fn1(100), it causes an error:

      MariaDB [test]> select fn1(100);
      ERROR 2027 (HY000): Malformed packet

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.