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

Assertion `! is_set()' failed in Diagnostics_area::disable_status upon EXPLAIN SELECT INTO OUTFILE executed via prepared statement

    XMLWordPrintable

Details

    Description

      10.3 779151db80

      mysqld: /data/src/10.3/sql/sql_error.cc:484: void Diagnostics_area::disable_status(): Assertion `! is_set()' failed.
      181226  2:13:35 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007ff202399ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000055ef5bf202e4 in Diagnostics_area::disable_status (this=0x7ff190006068) at /data/src/10.3/sql/sql_error.cc:484
      #9  0x000055ef5bf889ce in send_prep_stmt (stmt=0x7ff19000c1e0, columns=0) at /data/src/10.3/sql/sql_prepare.cc:393
      #10 0x000055ef5bf8cc59 in check_prepared_statement (stmt=0x7ff19000c1e0) at /data/src/10.3/sql/sql_prepare.cc:2529
      #11 0x000055ef5bf9076c in Prepared_statement::prepare (this=0x7ff19000c1e0, packet=0x7ff19001ba31 "", packet_len=53) at /data/src/10.3/sql/sql_prepare.cc:4009
      #12 0x000055ef5bf8cfc3 in mysqld_stmt_prepare (thd=0x7ff190000b00, packet=0x7ff19001ba31 "", packet_length=53) at /data/src/10.3/sql/sql_prepare.cc:2631
      #13 0x000055ef5bf61d38 in dispatch_command (command=COM_STMT_PREPARE, thd=0x7ff190000b00, packet=0x7ff19001ba31 "", packet_length=53, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1808
      #14 0x000055ef5bf60aa1 in do_command (thd=0x7ff190000b00) at /data/src/10.3/sql/sql_parse.cc:1396
      #15 0x000055ef5c0c8ab0 in do_handle_one_connection (connect=0x55ef60a894e0) at /data/src/10.3/sql/sql_connect.cc:1402
      #16 0x000055ef5c0c8834 in handle_one_connection (arg=0x55ef60a894e0) at /data/src/10.3/sql/sql_connect.cc:1308
      #17 0x00007ff203e55494 in start_thread (arg=0x7ff20009b700) at pthread_create.c:333
      #18 0x00007ff20245693f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      I've had it with libmysqlclient / libmariadb, including current 10.1 and 10.3, Perl DBI (linked with who-knows-what), and with MariaDB Java connector 1.7.0. Couldn't reproduce with Java connector 1.7.1+.
      Couldn't reproduce it with MTR, even after patching it to allow prepared statements for EXPLAIN.
      Didn't try any other connectors/tools.
      Couldn't reproduce with 10.2 server.

      C test

      #include <mysql.h>
      #include <stdlib.h>
      #include <stdio.h>
       
      int main(int argc, char **argv)
      {  
        MYSQL *con = mysql_init(NULL);
        MYSQL_STMT *stmt = mysql_stmt_init(con);
       
        if (con == NULL) 
        {
            fprintf(stderr, "%s\n", mysql_error(con));
            exit(1);
        }
       
        if (mysql_real_connect(con, "127.0.0.1", "root", "", 
                "test", 0, NULL, 0) == NULL) 
        {
            fprintf(stderr, "%s\n", mysql_error(con));
            mysql_close(con);
            exit(1);
        }
       
        if (mysql_stmt_prepare(stmt,
          "EXPLAIN SELECT * INTO OUTFILE 'load.data' FROM mysql.db", 55)) 
        {
          fprintf(stderr, "%s\n", mysql_error(con));
          mysql_close(con);
          exit(1);
        }
       
        if (mysql_stmt_execute(stmt))
        {
          fprintf(stderr, " %s\n", mysql_stmt_error(stmt));
          exit(1);
        }
       
        mysql_close(con);
        exit(0);
      }
      

      Java test

      import java.sql.DriverManager;
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.util.Arrays;
       
      public class JConnectorTest
      {
        public static void main (String argv[])	
        {
          Boolean ret;
          PreparedStatement injerto;
          Connection conn;
          try {
            conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","");
            PreparedStatement ps = conn.prepareStatement("EXPLAIN SELECT * INTO OUTFILE 'load.data' FROM mysql.db");
            ps.addBatch();
            int[] count = ps.executeBatch();
            System.out.println("Result: " + Arrays.toString(count));
          }
          catch (Exception e)
          {
            System.out.println("Exception: " + e + "\n");
          }
        }
      } 
      

      Perl test

      use DBI;
      use strict;
       
      my $dbh = DBI->connect("dbi:mysql:host=127.0.0.1:port=3306:user=root:database=test;mysql_server_prepare=1");
       
      unless (defined $dbh) {
        print "Couldn't connect: ".$DBI::errstr."\n";
        exit 1;
      }
       
      print "All good\n" if $dbh->do("EXPLAIN SELECT * INTO OUTFILE 'load.data' FROM mysql.db");
       
      $dbh->disconnect();
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              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.