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

Garbage written into slow log for SET SESSION AUTHORIZATION command, assertion fails

Details

    Description

      set @slow1= @@global.log_slow_query, @slow2= @@global.log_slow_query_time;
       
      --connect (con1,localhost,root,,)
      create user u@localhost;
      set global log_slow_query=on, log_slow_query_time=0.000001;
      set session authorization u@localhost;
      --disconnect con1
       
      --connection default
      --cat_file $MYSQLTEST_VARDIR/mysqld.1/mysqld-slow.log
      drop user u@localhost;
      set global log_slow_query=@slow1, log_slow_query_time=@slow2;
      

      283183cf22d4a74d7b0dd959be9898b7cfa7d930 non-debug

      Time		    Id Command	Argument
      # User@Host: u[u] @ localhost []
      # Thread_id: 5  Schema:   QC_hit: No
      # Query_time: 0.000008  Lock_time: 0.000000  Rows_sent: 0  Rows_examined: 0
      # Rows_affected: 0  Bytes_sent: 18446744073709551336
      SET timestamp=0;
      set session authorization u@localhost;
      

      Both the timestamp and Bytes_sent value are obviously wrong.

      A debug build aborts upon assertion failure:

      283183cf22d4a74d7b0dd959be9898b7cfa7d930 debug

      mariadbd: /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/log.cc:1497: bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong): Assertion `thd->start_time || thd->start_time_sec_part' failed.
      250413 22:26:08 [ERROR] /share8t/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/mariadbd got signal 6 ;
       
      #9  0x00007f8d65c53eb2 in __GI___assert_fail (assertion=0x5585ab6f4a00 "thd->start_time || thd->start_time_sec_part", file=0x5585ab6f3900 "/data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/log.cc", line=1497, function=0x5585ab6f4900 "bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong)") at ./assert/assert.c:101
      #10 0x00005585a99fd51a in LOGGER::slow_log_print (this=0x5585ad87ac20 <logger>, thd=0x62c0000f0218, query=0x62d000564438 "set session authorization u@localhost", query_length=37, current_utime=5433698068878) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/log.cc:1497
      #11 0x00005585a9a24fdc in slow_log_print (thd=0x62c0000f0218, query=0x62d000564438 "set session authorization u@localhost", query_length=37, current_utime=5433698068878) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/log.cc:7679
      #12 0x00005585a8ce7b76 in log_slow_statement (thd=0x62c0000f0218) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/sql_parse.cc:2583
      #13 0x00005585a8ce6c0d in dispatch_command (command=COM_QUERY, thd=0x62c0000f0218, packet=0x62900025d219 "", packet_length=37, blocking=true) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/sql_parse.cc:2448
      #14 0x00005585a8ce028d in do_command (thd=0x62c0000f0218, blocking=true) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/sql_parse.cc:1415
      #15 0x00005585a91dcab1 in do_handle_one_connection (connect=0x608000003738, put_in_cache=true) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/sql_connect.cc:1415
      #16 0x00005585a91dc610 in handle_one_connection (arg=0x608000003738) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/sql/sql_connect.cc:1327
      #17 0x00005585a9e9de62 in pfs_spawn_thread (arg=0x617000005f18) at /data/bld/preview-12.0-bb-12.0-MDEV-20299-authorization-asan/storage/perfschema/pfs.cc:2198
      #18 0x00007f8d65ca81c4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #19 0x00007f8d65d2885c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Attachments

        Issue Links

          Activity

            If slow log is written into a table, the assertion failure still occurs, while a non-debug build doesn't write a record to the table, instead an error in the error log appears:

            2025-04-13 22:37:47 5 [ERROR] Failed to write to mysql.slow_log: Can't write data (possible incorrect log table structure)
            

            elenst Elena Stepanova added a comment - If slow log is written into a table, the assertion failure still occurs, while a non-debug build doesn't write a record to the table, instead an error in the error log appears: 2025-04-13 22:37:47 5 [ERROR] Failed to write to mysql.slow_log: Can't write data (possible incorrect log table structure)

            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.