Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
When trying to call repeated mysql_library_init() and mysql_library_end() it fails on different error.
With MariaDB Connector/C 2.3.2 I can call
mysql_library_init(-1, NULL, NULL);
|
mysql_library_end();
|
above code only 1024 times. At 1025 step it fails with error:
Can't initialize threads: error 95
|
With client from MariaDB 10.3.6 above code can be called only one time. After second time it fails with error:
Plugin pvio_socket could not be loaded: not initialized
|
With client from MariaDB 10.1.26 everything is working fine and 10000 iteration passed without problem.
This problem was found while developing Perl DBI driver DBD::MariaDB:
http://github.com/gooddata/DBD-MariaDB
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`
Attachments
Issue Links
- relates to
-
MDEV-16578 Repeated mysql_library_init()+mysql_library_end() calls freeze running process
-
- Closed
-
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.