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

Assertion `0' fails in Protocol::end_statement on CREATE VIEW after another connection aborted

    XMLWordPrintable

Details

    Description

      10.0/sql/protocol.cc:522: void Protocol::end_statement(): Assertion `0' failed.
      150424 18:45:26 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f1cfb0c2311 in *__GI___assert_fail (assertion=0xee5f70 "0", file=<optimized out>, line=522, function=0xee7480 "void Protocol::end_statement()") at assert.c:81
      #7  0x00000000005d36ab in Protocol::end_statement (this=0x7f1ce2bf85f8) at 10.0/sql/protocol.cc:522
      #8  0x000000000067af47 in dispatch_command (command=COM_QUERY, thd=0x7f1ce2bf8070, packet=0x7f1ce2a18071 "CREATE VIEW v12 AS SELECT 1", packet_length=27) at 10.0/sql/sql_parse.cc:1721
      #9  0x0000000000678eaf in do_command (thd=0x7f1ce2bf8070) at 10.0/sql/sql_parse.cc:996
      #10 0x00000000007966bf in do_handle_one_connection (thd_arg=0x7f1ce2bf8070) at 10.0/sql/sql_connect.cc:1375
      #11 0x0000000000796412 in handle_one_connection (arg=0x7f1ce2bf8070) at 10.0/sql/sql_connect.cc:1289
      #12 0x00007f1cfcebcb50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #13 0x00007f1cfb17295d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Perl testcase

      # It assumes the debug server is running on port 3306. 
      # All default options are enough
       
      use DBD::mysql;
      use Carp;
       
      my $pid = fork();
       
      if ($pid) {
      	sleep 1;
      	my $dbh = DBI->connect("dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test", undef, undef, { RaiseError => 1 } );
      	foreach (1..100) {
      		$dbh->do("CREATE OR REPLACE VIEW v AS SELECT 1");
      	}
      	$dbh->do("shutdown");
      	print "All done.\n";
      }
      elsif ($pid == 0) {
      	my $dbh = DBI->connect("dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test", undef, undef, { RaiseError => 1 } );
      	sleep 2;
      	croak "$$ Aborting now";
      }
       
      else {
      	die "Could not fork";
      }

      Apparently the problem appeared in 10.0 tree with the following revision:

      commit 919443f7a553534de38d40a5cdf50cd3660ace1a
      Author: Sergei Golubchik <sergii@pisem.net>
      Date:   Mon Jan 19 16:11:48 2015 +0100
       
          MDEV-5679 MariaDB holds stdin open after startup as mysqld
       
      diff --git a/sql/mysqld.cc b/sql/mysqld.cc
      index e0eaf55..7138027 100644
      --- a/sql/mysqld.cc
      +++ b/sql/mysqld.cc
      @@ -5527,6 +5527,7 @@ int mysqld_main(int argc, char **argv)
                                (char*) "" : mysqld_unix_port),
                                mysqld_port,
                                MYSQL_COMPILATION_COMMENT);
      +  fclose(stdin);
       #if defined(_WIN32) && !defined(EMBEDDED_LIBRARY)
         Service.SetRunning();
       #endif

      Same happens on CREATE TRIGGER.

      Attachments

        Activity

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            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.