[MDEV-4149] Assertion `thd' fails in my_malloc_size_cb_func on server shutdown with a valgrind build Created: 2013-02-07  Updated: 2018-10-09  Resolved: 2013-02-08

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: 10.0.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Elena Stepanova
Resolution: Fixed Votes: 0
Labels: None
Environment:

Ubuntu 11.10 64-bit, Ubuntu 12.04 64-bit


Issue Links:
Relates
relates to MDEV-17413 Crash on shutdown in my_malloc_size_c... Closed

 Description   

revision-id: sergii@pisem.net-20130205094326-4yeuozh5iemlqley
revno: 3496
branch-nick: 10.0-base

Built with BUILD/compile-pentium-valgrind-max-no-ndb

mysqld: sql/mysqld.cc:3473: void my_malloc_size_cb_func(long long int, my_bool): Assertion `thd' failed.
[ERROR] mysqld got signal 6 ;

#4  0x00007ff636e6d425 in __GI_raise (sig=<optimised out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#5  0x00007ff636e70b8b in __GI_abort () at abort.c:91
#6  0x00007ff636e660ee in __assert_fail_base (fmt=<optimised out>, assertion=0xd65cc9 "thd", file=0xd64a38 "10.0-base/sql/mysqld.cc", line=<optimised out>, function=<optimised out>) at assert.c:94
#7  0x00007ff636e66192 in __GI___assert_fail (assertion=0xd65cc9 "thd", file=0xd64a38 "10.0-base/sql/mysqld.cc", line=3473, function=0xd6af60 "void my_malloc_size_cb_func(long long int, my_bool)") at assert.c:103
#8  0x000000000055f68f in my_malloc_size_cb_func (size=360, is_thread_specific=1 '\001') at 10.0-base/sql/mysqld.cc:3473
#9  0x0000000000cf176a in update_malloc_size (size=360, is_thread_specific=1 '\001') at 10.0-base/mysys/my_malloc.c:66
#10 0x0000000000cf192d in my_malloc (size=352, my_flags=65544) at 10.0-base/mysys/my_malloc.c:118
#11 0x0000000000625108 in reap_plugins () at 10.0-base/sql/sql_plugin.cc:1231
#12 0x0000000000626df9 in plugin_shutdown () at 10.0-base/sql/sql_plugin.cc:1908
#13 0x000000000055caf2 in clean_up (print_message=true) at 10.0-base/sql/mysqld.cc:1833
#14 0x000000000055c8a4 in unireg_end () at 10.0-base/sql/mysqld.cc:1743
#15 0x000000000055c7c8 in kill_server (sig_ptr=0x0) at 10.0-base/sql/mysqld.cc:1671
#16 0x000000000055c7e3 in kill_server_thread (arg=0x7ff634049e48) at 10.0-base/sql/mysqld.cc:1694
#17 0x0000000000c59a62 in pfs_spawn_thread (arg=0x7ff624001108) at 10.0-base/storage/perfschema/pfs.cc:1015
#18 0x00007ff637c36e9a in start_thread (arg=0x7ff628548700) at pthread_create.c:308
#19 0x00007ff636f2acbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

To reproduce, build as described and run

perl ./mtr main.1st



 Comments   
Comment by Elena Stepanova [ 2013-02-07 ]

The problem appeared with the following revision:

revno: 3486
revision-id: sergii@pisem.net-20130128140636-y4getr57mbf0xq9y
parent: sergii@pisem.net-20130124165225-gczln6zrzi4lz4bx
committer: Sergei Golubchik <sergii@pisem.net>
branch nick: 10.0-base
timestamp: Mon 2013-01-28 15:06:36 +0100
message:
my_alloca() when it's mapped to malloc() works most certainly MY_THREAD_SPECIFIC

and I presume it was fixed by the following revision, but in 10.0 only:

revno: 3496
revision-id: sergii@pisem.net-20130131203221-2xsc0dp0r916bnu1
parent: sergii@pisem.net-20130131145126-4xnbqhr4hmuij61v
committer: Sergei Golubchik <sergii@pisem.net>
branch nick: 10.0
timestamp: Thu 2013-01-31 21:32:21 +0100
message:
fix for a valgrind builds.
my_alloca() cannot have MY_THREAD_SPECIFIC, because can be used
outside of the THD context.

Comment by Elena Stepanova [ 2013-02-08 ]

Backported the fix from 10.0, pushed into 10.0-base

Generated at Thu Feb 08 06:54:10 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.