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

Assertion `(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)' failed in my_realloc from sort_get_next_record on INSERT

    XMLWordPrintable

Details

    Description

      Note the required --max_allowed_packet option.

      # Test using: ./mtr --mysqld=--max_allowed_packet=33554432 test
      SET sql_mode='', aria_repair_threads=2;
      CREATE TEMPORARY TABLE t (b TEXT, INDEX s(b(3000))) ROW_FORMAT=DYNAMIC ENGINE=Aria;
      INSERT INTO t VALUES (REPEAT ('a',33554428));
      CREATE TABLE ti LIKE t;
      INSERT INTO ti SELECT * FROM t;
      

      11.4.0 faf48c262fd3f350b91482865b1bc1d8a037502b (Optimized)

      mariadbd: /test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c:156: my_realloc: Assertion `(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)' failed.
      

      11.4.0 faf48c262fd3f350b91482865b1bc1d8a037502b (Optimized)

      Core was generated by `/test/MDEV33426_MD160224-mariadb-11.4.0-linux-x86_64-opt/bin/mariadbd --no-defa'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23081625097792)
          at ./nptl/pthread_kill.c:44
      [Current thread is 1 (LWP 2502992)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=23081625097792) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=23081625097792) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=23081625097792, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
      #3  0x000014fe33e42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #4  0x000014fe33e287f3 in __GI_abort () at ./stdlib/abort.c:79
      #5  0x000014fe33e2871b in __assert_fail_base (fmt=0x14fe33fdd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x558df086f050 "(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)", file=0x558df086ef68 "/test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c", line=156, function=<optimized out>) at ./assert/assert.c:92
      #6  0x000014fe33e39e96 in __GI___assert_fail (assertion=assertion@entry=0x558df086f050 "(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)", file=file@entry=0x558df086ef68 "/test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c", line=line@entry=156, function=function@entry=0x558df086f088 <__PRETTY_FUNCTION__.0> "my_realloc") at ./assert/assert.c:101
      #7  0x0000558df03be372 in my_realloc (key=key@entry=0, old_point=0x14fde00a5468, size=size@entry=65635, my_flags=64) at /test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c:156
      #8  0x0000558defecdf44 in _ma_alloc_buffer (old_addr=old_addr@entry=0x14fde002dac8, old_size=old_size@entry=0x14fde002dd90, new_size=65635, flag=<optimized out>) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_open.c:1257
      #9  0x0000558deff0cc51 in sort_get_next_record (sort_param=sort_param@entry=0x14fde002d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_check.c:5269
      #10 0x0000558deff0e784 in sort_key_read (sort_param=0x14fde002d5e8, key=0x14fde4000d70 '\245' <repeats 200 times>...) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_check.c:4831
      #11 0x0000558deff115d1 in _ma_thr_find_all_keys_exec (sort_param=0x14fde002d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_sort.c:491
      #12 _ma_thr_find_all_keys (arg=0x14fde002d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_sort.c:546
      #13 0x000014fe33e94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #14 0x000014fe33f26850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      11.4.0 faf48c262fd3f350b91482865b1bc1d8a037502b (Debug)

      mariadbd: /test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c:156: my_realloc: Assertion `(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)' failed.
      

      11.4.0 faf48c262fd3f350b91482865b1bc1d8a037502b (Debug)

      Core was generated by `/test/MDEV33426_MD160224-mariadb-11.4.0-linux-x86_64-dbg/bin/mariadbd --no-defa'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22668503918144)
          at ./nptl/pthread_kill.c:44
      [Current thread is 1 (LWP 3317532)]
      (gdb) bt
      #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=22668503918144) at ./nptl/pthread_kill.c:44
      #1  __pthread_kill_internal (signo=6, threadid=22668503918144) at ./nptl/pthread_kill.c:78
      #2  __GI___pthread_kill (threadid=22668503918144, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
      #3  0x0000149e01c42476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
      #4  0x0000149e01c287f3 in __GI_abort () at ./stdlib/abort.c:79
      #5  0x0000149e01c2871b in __assert_fail_base (fmt=0x149e01ddd130 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x55b57b391050 "(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)", file=0x55b57b390f68 "/test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c", line=156, function=<optimized out>) at ./assert/assert.c:92
      #6  0x0000149e01c39e96 in __GI___assert_fail (assertion=assertion@entry=0x55b57b391050 "(old_flags & 1) == ((my_flags & 0x10000U) ? 1 : 0)", file=file@entry=0x55b57b390f68 "/test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c", line=line@entry=156, function=function@entry=0x55b57b391088 <__PRETTY_FUNCTION__.0> "my_realloc") at ./assert/assert.c:101
      #7  0x000055b57aee0372 in my_realloc (key=key@entry=0, old_point=0x149dac0a5468, size=size@entry=65635, my_flags=64) at /test/knielsen_mdev33426_11.4_dbg/mysys/my_malloc.c:156
      #8  0x000055b57a9eff44 in _ma_alloc_buffer (old_addr=old_addr@entry=0x149dac02dac8, old_size=old_size@entry=0x149dac02dd90, new_size=65635, flag=<optimized out>) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_open.c:1257
      #9  0x000055b57aa2ec51 in sort_get_next_record (sort_param=sort_param@entry=0x149dac02d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_check.c:5269
      #10 0x000055b57aa30784 in sort_key_read (sort_param=0x149dac02d5e8, key=0x149db0000d70 '\245' <repeats 200 times>...) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_check.c:4831
      #11 0x000055b57aa335d1 in _ma_thr_find_all_keys_exec (sort_param=0x149dac02d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_sort.c:491
      #12 _ma_thr_find_all_keys (arg=0x149dac02d5e8) at /test/knielsen_mdev33426_11.4_dbg/storage/maria/ma_sort.c:546
      #13 0x0000149e01c94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #14 0x0000149e01d26850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Only occurs in knielsen_mdev33426_11.4 at revision faf48c262fd3f350b91482865b1bc1d8a037502b
      When only that revision (i.e. the MDEV-33426 patch) is removed, the crash does not happen, however we see:

      11.4.0 4eac842c8f9814ffabf14c8074717d7c4511a72e (Optimized)

      2024-02-29 14:48:08 0 [Note] /test/PRE_PATCH_MDEV33426_MD160224-mariadb-11.4.0-linux-x86_64-opt/bin/mariadbd: Shutdown complete
       
      Warning: Memory not freed: 63312
      

      Possibly this is the memory loss seen (and fixed) in MDEV-33426, though the amount differs and is a positive number this time.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.