DBI/p5-DBD-mysql wity MySQL 8

Stephane Russell srussell at prodigeinfo.qc.ca
Mon Oct 14 11:44:49 PDT 2024


Is there anybody who tried DBI with MySQL 8 on DragonFly v6.4? 
p5-DBD-mysql fails its tests by having perl dumping its core. I 
extracted some code an tested,  just a simple call like this always give 
the same result:

         $dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host",
             $db_user, $db_pass,
             { PrintError => 0, AutoCommit => 1, RaiseError => 1 }

Here is what DBI throws at me:

     DBI 1.643-ithread default trace level set to 0x0/5 (pid 365632 pi 
80048f000) at mysqlconnect.pl line 22
     -> DBI->connect(DBI:mysql:database=xxx;host=127.0.0.1, xxx, ****, 
HASH(0x80185cbd0))
     -> DBI->install_driver(mysql) for dragonfly perl=5.032001 
pid=365632 ruid=1000 euid=1000
        install_driver: DBD::mysql version 5.009 loaded from 
/usr/local/lib/perl5/site_perl/mach/5.32/DBD/mysql.pm
     New 'DBI::dr' (for DBD::mysql::dr, parent='', id=undef)
dbih_setup_handle(DBI::dr=HASH(0x80213e5a0)=>DBI::dr=HASH(0x80213e558), 
DBD::mysql::dr, 0, Null!)
     dbih_make_com(Null!, 0, DBD::mysql::dr, 152, 0) thr#80048f000
     dbih_setup_attrib(DBI::dr=HASH(0x80213e558), Err, Null!) 
SCALAR(0x8020fd0c0) (already defined)
     dbih_setup_attrib(DBI::dr=HASH(0x80213e558), State, Null!) 
SCALAR(0x801c1b510) (already defined)
     dbih_setup_attrib(DBI::dr=HASH(0x80213e558), Errstr, Null!) 
SCALAR(0x8020fd120) (already defined)
     dbih_setup_attrib(DBI::dr=HASH(0x80213e558), TraceLevel, Null!) 0 
(already defined)
     dbih_setup_attrib(DBI::dr=HASH(0x80213e558), FetchHashKeyName, 
Null!) 'NAME' (already defined)
     <- install_driver= DBI::dr=HASH(0x80213e5a0)
     !! The warn '0' was CLEARED by call to connect method
     -> connect for DBD::mysql::dr 
(DBI::dr=HASH(0x80213e5a0)~0x80213e558 'database=xxx;host=127.0.0.1' 
'xxx' **** HASH(0x801b79d08)) thr#80048f000
     New 'DBI::db' (for DBD::mysql::db, 
parent=DBI::dr=HASH(0x80213e558), id=HASH(0x80213fb28))
dbih_setup_handle(DBI::db=HASH(0x80213f9a8)=>DBI::db=HASH(0x80213fc48), 
DBD::mysql::db, 801c1b828, HASH(0x80213fb28))
     dbih_make_com(DBI::dr=HASH(0x80213e558), 8017f0520, DBD::mysql::db, 
192, 80213fba0) thr#80048f000
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), Err, 
DBI::dr=HASH(0x80213e558)) SCALAR(0x801c1ba80) (already defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), State, 
DBI::dr=HASH(0x80213e558)) SCALAR(0x801c1bb10) (already defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), Errstr, 
DBI::dr=HASH(0x80213e558)) SCALAR(0x801c1bac8) (already defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), TraceLevel, 
DBI::dr=HASH(0x80213e558)) 0 (already defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), FetchHashKeyName, 
DBI::dr=HASH(0x80213e558)) 'NAME' (already defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), HandleSetErr, 
DBI::dr=HASH(0x80213e558)) undef (not defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), HandleError, 
DBI::dr=HASH(0x80213e558)) undef (not defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), ReadOnly, 
DBI::dr=HASH(0x80213e558)) undef (not defined)
     dbih_setup_attrib(DBI::db=HASH(0x80213fc48), Profile, 
DBI::dr=HASH(0x80213e558)) undef (not defined)
imp_dbh->connect: dsn = database=xxx;host=127.0.0.1, uid = xxx, pwd = xxx
imp_dbh->my_login : dbname = xxx, uid = xxx, pwd = xxx,host = 127.0.0.1, 
port = NULL
imp_dbh->mysql_dr_connect: host = |127.0.0.1|, port = 0, uid = xxx, pwd 
= xxx
imp_dbh->bind_type_guessing: 0
imp_dbh->use_server_side_prepare: 0
imp_dbh->disable_fallback_for_server_prepare: 0
mysql_options: MYSQL_SET_CHARSET_NAME=utf8
imp_dbh->mysql_dr_connect: client_flags = 2
Segmentation fault (core dumped)

When I'm doing a 'target core' in gdb, I get this:

(gdb) target core perl.core
[New process 1]
Core was generated by `perl'.
Program terminated with signal 11, Segmentation fault.
#0  0x0000000000000000 in ?? ()
(gdb) where
#0  0x0000000000000000 in ?? ()
#1  0x00000008031eb8f0 in __once_proxy () from /usr/lib/gcc80/libstdc++.so.9
#2  0x00000008009f1cc3 in pthread_once () from /usr/lib/libpthread.so.0
#3  0x0000000802526aa7 in void std::call_once<void 
(&)()>(std::once_flag&, void (&)()) () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#4  0x00000008025276f1 in my_charset_get_by_name(MY_CHARSET_LOADER*, 
char const*, unsigned int, int) () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#5  0x00000008025277d4 in get_charset_by_csname(char const*, unsigned 
int, int) () from /usr/local/lib/mysql/libmysqlclient.so.21
#6  0x00000008024d688a in mysql_init_character_set(MYSQL*) () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#7  0x00000008024d6a8c in ?? () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#8  0x00000008024d91d9 in connect_helper () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#9  0x00000008024d7435 in mysql_real_connect () from 
/usr/local/lib/mysql/libmysqlclient.so.21
#10 0x0000000802465b8e in mysql_dr_connect (dbh=dbh at entry=0x802337c18, 
sock=0x801916a00, mysql_socket=mysql_socket at entry=0x0, 
host=host at entry=0x0, port=port at entry=0x0,
     user=user at entry=0x80051ebb0 "root", password=0x0, 
dbname=0x80051ec20 "test", imp_dbh=<optimized out>) at dbdimp.c:2107
#11 0x0000000802468583 in my_login (my_perl=my_perl at entry=0x80048f000, 
dbh=dbh at entry=0x802337c18, imp_dbh=imp_dbh at entry=0x801930e90) at 
dbdimp.c:2235
#12 0x00000008024686bc in mysql_db_login (dbh=dbh at entry=0x802337c18, 
imp_dbh=imp_dbh at entry=0x801930e90, dbname=<optimized out>, 
user=user at entry=0x80051ebb0 "root",
     password=<optimized out>) at dbdimp.c:2285
#13 0x0000000802473e97 in XS_DBD__mysql__db__login (my_perl=0x80048f000, 
cv=<optimized out>) at ./mysql.xsi:128
#14 0x0000000800774d35 in Perl_pp_entersub () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#15 0x000000080076b096 in Perl_runops_standard () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#16 0x00000008006d1732 in Perl_call_sv () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#17 0x0000000801af9689 in XS_DBI_dispatch () from 
/usr/local/lib/perl5/site_perl/mach/5.32/auto/DBI/DBI.so
#18 0x0000000800774d35 in Perl_pp_entersub () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#19 0x000000080076b096 in Perl_runops_standard () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#20 0x00000008006da417 in perl_run () from 
/usr/local/lib/perl5/5.32/mach/CORE/libperl.so.5.32
#21 0x0000000000400de4 in main ()

I tried with different setup, I tried with the latest dports version on 
a new VM, I manually upgraded DBD-mysql to version 5.009 (dports changes 
attached to this email), but despite an insane amount of hours, I found 
no fix nor workarounds other then to downgrade back MySQL to version 5.x.

When I isolate the code in DBD-mysql's dbdimp.c the connexion is made 
normaly. When I remove any particular code directly in dbdimp.c to get 
the code as close as possible as the isolated one, perl still dump its 
core. The only difference to my view is that my tests are not made from 
a thread.

Is it possible that there is some incompatibility between perl5 threads 
on DfBSD and some changes made in MySQL 8?

Aside, I wanted to replace MySQL with mariadb 10.6, but the -server is 
conflicting with the -client in dports. It would require some work to 
fix, so I couldn't validate if DBD-mysql works with it. No luck here too.

Thanks for any clue on this.

   -- SR



-------------- next part --------------
A non-text attachment was scrubbed...
Name: p5-DBD-mysql.tgz
Type: application/x-compressed-tar
Size: 1235 bytes
Desc: not available
URL: <http://lists.dragonflybsd.org/pipermail/users/attachments/20241014/d696a707/attachment.bin>


More information about the Users mailing list