-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DBD::MariaDB support #50
Comments
Would you like to submit a PR to add it? |
Looks like all it takes is to copy DBIx::Connector::Driver::mysql to DBIx::Connector::Driver::MariaDB and search/replace all "mysql" and "MySQL" strings to "MariaDB", except "mysql_auto_reconnect" becomes "mariadb_auto_reconnect". I'll put together the whole file tomorrow. Just having this there fixes a big performance problem I was having (disconnects were 2x slower) though I don't know yet if it fixes the SIGBUS issue on disconnect. |
Why would there be a performance improvement from making this change? |
Hello! I did this: #52 Can you check up this and to approve and to publish? Thanks! |
Looks good to me. Sorry I sat on that for so long. |
Back to the coredump issue, I finally have a small script to reproduce the issue, at the risk of making me look like an idiot for doing something dumb: #!/usr/local/bin/perl On FreeBSD 14.1 this code will create MANY coredumps, all apparently when the child process DB handles try to disconnect. The code does run successfully anyway (but obviously slowly because of all the core files being written) because the crash is when the child is trying to exit anyway. On Ubuntu 24.04 this code instead prints this at every DB disconnect -- but not every time the program runs, just sometimes: panic: DBI active kids (-1) < 0 or > kids (0) at /usr/lib/x86_64-linux-gnu/perl5/5.38/DBI.pm line 759. To stop that warning (Ubuntu) or coredumps (FreeBSD) any one of the following works:
OR
OR
|
|
|
Thank you!
Not confident what you mean here. No difference to what, or in what? What I’m after here is an answer to this question: disregarding the crash bug, does the patch from branch
Does “no difference” mean “yes, it works the same as that, including the crash bug”? |
Ok, testing with the master versions of DBD::MariaDB and DBIx::Connector, I'm not seeing any difference in behavior -- still core dumps on FreeBSD, still the same error (and an occasional not-noticed-until-now coredump) on Ubuntu. The coredump on FreeBSD looks like this:
If anyone wants a run on either OS with DBI->trace(4) or something similar, let me know. |
This fix seems to solve things: https://github.com/perl5-dbi/DBD-MariaDB/compare/master...choroba:inactive-destroy?expand=1 |
That’s not surprising, I didn’t make any relevant changes on |
Hello everyone, I would like to mention that I also use the The key difference from what has been discussed so far is that I establish the database connection from the forked child processes directly, not from the parent process. Naturally, if you establish a connection in the parent process and then try to use those connections in the child processes, it can lead to unpredictable behavior, including core dumps. I have encountered such issues in the past, even with a standard MySQL database and the DBD::MySQL driver. Therefore, I don't see the benefit of connecting to the database from the parent process. The issue you're facing seems to stem from improper handling of processes. |
Release 0.60 with support for MariaDB is on its way to the CPAN. The crash appears to be a DBD::MariaDB issue and is fixed by a patch provided there. So it looks like there is nothing left to do here. Thanks to everyone for the helpful research and observations. |
Trying to use DBD::MariaDB in place of DBD::mysql results in some weird behavior sometimes, notably Perl crashing (SIGBUS core dump, on FreeBSD at least) when disconnecting from the database when mixed with Parallel::ForkManager. Obviously normally Parallel::ForkManager shouldn't be used with open DBI handles, but that's one of the things DBIx::Connector is supposed to make "safe". And with the DBD::mysql driver, it is.
I've not tried making my own DBIx::Connector driver for MariaDB by copying the MySQL one yet.
The main difference between the two drivers is their handling of Unicode strings.
The text was updated successfully, but these errors were encountered: