[MDEV-16578] Repeated mysql_library_init()+mysql_library_end() calls freeze running process Created: 2018-06-25 Updated: 2024-01-30 Resolved: 2024-01-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Embedded Server |
| Affects Version/s: | 10.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Pali | Assignee: | Sergei Golubchik |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
When test test-init.c from
This is from MariaDB version 10.1.26, which is available in current Debian stable. So problem is in function mysql_server_end which cause that deadlock. Originally reported in comment: https://jira.mariadb.org/browse/CONC-336?focusedCommentId=111921&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-111921 |
| Comments |
| Comment by Elena Stepanova [ 2018-07-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Did you see georg's comment after yours in
Is the hang still reproducible if you don't initialize the library multiple times? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2018-07-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, I saw that comment, but it does not apply here. If you initialize library without embedded server and then you want to start embedded server you need to first deinitialize it and then initialize it again (with embedded server args). Similarly when you initialized library with embedded server, then embedded server is running. And when you want to stop embedded server you can do that only via deinitializing library (mysql_library_end() resp. mysql_server_end()). Please note that this logic is used in Perl DBI driver, which provides uniform upper-layer database interface for Perl applications and implements library access to mysql/mariadb client. Therefore if upper-layer ask for closing embedded server connection, then DBI driver needs to call mysql_server_end(). And after that if upper-layer ask for new remote connection, DBI driver needs to call mysql_library_init()/mysql_server_init() again. Important part is that everything is running in one process in which is loaded Perl interpreter and this cannot be (easily) changed. JDBC or other similar interfaces can use one process per connection or per driver to workaround those limitations, but this is not the case of Perl's DBI. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2018-09-28 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi elenst! Do you have any update for this issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2018-10-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I'll leave it to georg to comment on it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Georg Richter [ 2018-10-09 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I think this affects embedded elenst | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2019-06-18 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Yes, if affects embedded server. elenst, any update to this issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2020-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello sanja! Could you please look at this issue? Do you need more details or logs for this issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-02-02 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I looked (for embedded) for me it tries to take uninitialized mutex. Looks quite different from original bug. in any case what I lack is time to fix, sorry (the bug is in queue) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-08-23 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello sanja, any updates about this issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-09-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
10.1 is long out of support. What version are you using now? Is the bug still there? I'm getting different symptoms on 11.3 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-10-03 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I have tried testing application with mariadb 11.3.0 and it still crashes. Why you have closed this issue as incomplete? What is missing from me? I have provided description with simple testing application which reproduce it. So what is incomplete? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-10-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I've closed it as incomplete, because there was no answer for a month, so the assumption was that the original reporter (you) has lost interest and moved on, and I couldn't repeat the issue, so there was nothing we could do here. Now that you replied and clearly shown that the assumption was wrong, I've reopened it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-10-04 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So, if you cannot reproduce it, does it mean that it is working for you? That is quite strange as I just took source code package of 11.3.0 version, compiled it locally, linked it into the attached testing application and run it. And it still crashed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello, any progress on this issue? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Just to note that I have run testing application test-init.c from the description with mariadb 11.3.0 and it still crashes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-11-29 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I cannot repeat it (still):
doesn't crash. (LD_LIBRARY_PATH because I didn't install libmysqld.so globally) it was the latest 10.6, but as you said it crashes on 10.1 and on 11.3, I suppose 10.6 should crash too | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Otto Kekäläinen [ 2023-12-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I also tested this on building and running on Debian Bookworm with these build dependencies installed and using these commands: noformat gcc -W -Wall -O2 -g test-init.c -o test-init -I/usr/include/mariadb -I/usr/include/mariadb/mysql -L/usr/lib/x86_64-linux-gnu/ -lmariadb -lz -ldl -lm -lssl -lcrypto mariadb -Bse 'STATUS' -u mysql -pasdf234 Connection id: 182 ./test-init 2 localhost 3306 mysql asdf234 I was not able to reproduce a crash. Can you Pali please provide a reproducible case that is detailed enough so it can be reproduced? It can be as simple as a copy-paste of the commands you ran and their outputs. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Georg Richter [ 2023-12-01 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
otto You link against libmariadb, but the problem appears with libmysqld (embedded). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-12-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello, sorry for a longer delay. Now I have tested it with new 10.11.6 version (last 10 released at this time of testing) and the result is that this version is not affected by this bug. I'm going to test also other versions to figure out which are broken and which works. Because something must have been fixed in this 10.x version branch as I'm really sure that it was crashing. Here are steps which I used for future reproducing:
(MariaDB server is running on localhost at port 3306 and user named test can be used without password) Please check the steps if are correct and if I did not some mistake there. To ensure that correct library (libmysql*d*.so is symlink to libmariadb*d*.so) was used here is output from ldd:
And cmake showed following features details (in case some feature may affect this problem):
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-12-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Now I take MariaDB version 10.1.26 from the sources: https://archive.mariadb.org/mariadb-10.1.26/source/mariadb-10.1.26.tar.gz Then I used same steps for compiling as in the previous post but into cmake I added another parameter -DWITH_SSL=bundled because such old MariaDB version failed to compile with new OpenSSL. And testing application passed without any crash and without any deadlock. So I have feeling that this issue is related to some setup or something other. Becuase for sure the version from the description (10.1.26) caused this issue and I put into description backtrace where it hanged. So can be end_embedded_server() or its init function affected by some SSL library? Or some system / additional plugin? Or something other? If you have some idea or what can I test then please let me know. I think I do not have original machine with original system on which it was crashing. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-12-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
I see, thanks. Yes, it could be an SSL library, could be a specific plugin — there could be many things that don't like being initialized and deinitialized repeatedly. I mean, it's not a given that some piece of code can deinitialize itself back to its initial state. Still, it's likely some external library. I suspect your recent test most probably had exactly the same set of plugins of exactly same versions as your earlier tests, that exhibited the crash. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Pali [ 2023-12-25 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Now I tried another thing: I took Debian version of MariaDB 10.1.26 (which has patches) from archive:
Unpacked it via:
And then applied same build steps as before. But results are same. It is working. I do not know what else I can try... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2024-01-30 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
pali, I'll close it as Can't repeat then. If you'll stumble upon it again, please, just add a comment here and I'll reopen |