In attachment is a simple application to testing mysql_library_init() and mysql_library_end() calls. Compile it with gcc test-init.c -o test-init `mysql_config --cflags --libs`
And when above test-init.c is linked with `mysql_config --cflags --libmysqld-libs` then second run cause deadlock in inline_mysql_cond_destroy. Same reproducer, but third different error.
__lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
95 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Adresár alebo súbor neexistuje.
(gdb) bt
#0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007ffff6184eb5 in __pthread_cond_destroy (cond=cond@entry=0x7ffff7568ae0 <COND_thread_count>) at pthread_cond_destroy.c:34
#2 0x00007ffff67436c0 in inline_mysql_cond_destroy (that=0x7ffff7568ae0 <COND_thread_count>) at ./include/mysql/psi/mysql_thread.h:1131
#3 clean_up_mutexes () at ./libmysqld/../sql/mysqld.cc:2264
#4 0x00007ffff6748974 in end_embedded_server () at ./libmysqld/lib_sql.cc:648
#5 0x00007ffff674c7ec in mysql_server_end () at ./libmysql/libmysql.c:213
#6 0x00005555555549e4 in main (argc=<optimized out>, argv=<optimized out>) at test-init.c:49
(gdb)
This is from MariaDB version 10.1.26, which is available in current Debian stable.
So it is not only problem of Connector/C, but also of MariaDB server itself.
Pali
added a comment - And when above test-init.c is linked with `mysql_config --cflags --libmysqld-libs` then second run cause deadlock in inline_mysql_cond_destroy. Same reproducer, but third different error.
$ gcc -W -Wall -O2 -g test-init.c -o test-init `mysql_config --cflags --libmysqld-libs`
$ gdb --args ./test-init 2 127.0.0.1 3306 pali pali
...
(gdb) r
...
^C
Program received signal SIGINT, Interrupt.
__lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
95 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Adresár alebo súbor neexistuje.
(gdb) bt
#0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007ffff6184eb5 in __pthread_cond_destroy (cond=cond@entry=0x7ffff7568ae0 <COND_thread_count>) at pthread_cond_destroy.c:34
#2 0x00007ffff67436c0 in inline_mysql_cond_destroy (that=0x7ffff7568ae0 <COND_thread_count>) at ./include/mysql/psi/mysql_thread.h:1131
#3 clean_up_mutexes () at ./libmysqld/../sql/mysqld.cc:2264
#4 0x00007ffff6748974 in end_embedded_server () at ./libmysqld/lib_sql.cc:648
#5 0x00007ffff674c7ec in mysql_server_end () at ./libmysql/libmysql.c:213
#6 0x00005555555549e4 in main (argc=<optimized out>, argv=<optimized out>) at test-init.c:49
(gdb)
This is from MariaDB version 10.1.26, which is available in current Debian stable.
So it is not only problem of Connector/C, but also of MariaDB server itself.
Now bug is marked closed. Does it mean that both Connector/C and also libmysqld are fixed? As in "Fix Version/s" field is only 3.0.5 version. What is state with 2.3 series?
Pali
added a comment - Now bug is marked closed. Does it mean that both Connector/C and also libmysqld are fixed? As in "Fix Version/s" field is only 3.0.5 version. What is state with 2.3 series?
we will not fix it in C/C 2.3 series.
Please also note that there is no need to initialize the client library multiple times. If you don't call mysql_library_init explicitly a call to mysql_init will automatically initialize the library.
Georg Richter
added a comment - - edited Hi Pali,
we will not fix it in C/C 2.3 series.
Please also note that there is no need to initialize the client library multiple times. If you don't call mysql_library_init explicitly a call to mysql_init will automatically initialize the library.
And when above test-init.c is linked with `mysql_config --cflags --libmysqld-libs` then second run cause deadlock in inline_mysql_cond_destroy. Same reproducer, but third different error.
$ gcc -W -Wall -O2 -g test-init.c -o test-init `mysql_config --cflags --libmysqld-libs`
$ gdb --args ./test-init 2 127.0.0.1 3306 pali pali
...
(gdb) r
...
^C
Program received signal SIGINT, Interrupt.
__lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
95 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: Adresár alebo súbor neexistuje.
(gdb) bt
#0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007ffff6184eb5 in __pthread_cond_destroy (cond=cond@entry=0x7ffff7568ae0 <COND_thread_count>) at pthread_cond_destroy.c:34
#2 0x00007ffff67436c0 in inline_mysql_cond_destroy (that=0x7ffff7568ae0 <COND_thread_count>) at ./include/mysql/psi/mysql_thread.h:1131
#3 clean_up_mutexes () at ./libmysqld/../sql/mysqld.cc:2264
#4 0x00007ffff6748974 in end_embedded_server () at ./libmysqld/lib_sql.cc:648
#5 0x00007ffff674c7ec in mysql_server_end () at ./libmysql/libmysql.c:213
#6 0x00005555555549e4 in main (argc=<optimized out>, argv=<optimized out>) at test-init.c:49
(gdb)
This is from MariaDB version 10.1.26, which is available in current Debian stable.
So it is not only problem of Connector/C, but also of MariaDB server itself.