Open dveeden opened 8 months ago
Hi! It was me. 14.0-RELEASE-p5 mysql80-client-8.0.35 from pkg repository.
I have two such apps, but SIGSEGV only one. Opening/Closing database connection on each request not helps.
Do you happen do have a simple way to reproduce this? Do you have a backtrace?
I can reproduce problem. I don't have normal backtrace. app is launched by apache httpd mod_fastcgi. I have perl.core.
(gdb) core perl.core [New LWP 101036] Core was generated by `/usr/local/bin/perl /home/***/work.fcgi'. Program terminated with signal SIGSEGV, Segmentation fault. Address not mapped to object.
(gdb) bt
How to get full backtrace? :)
gdb /usr/local/bin/perl perl.core GNU gdb (GDB) 13.2 [GDB v13.2 for FreeBSD] Copyright (C) 2023 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-portbld-freebsd14.0". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.
For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from /usr/local/bin/perl... (No debugging symbols found in /usr/local/bin/perl) [New LWP 100939] Core was generated by `/usr/local/bin/perl /home/***/work.fcgi'. Program terminated with signal SIGSEGV, Segmentation fault. Address not mapped to object.
(gdb) bt
Probably related to this. I do get segfaults sometimes on Linux with Apache and fastcgi. I can't exactly reproduce, it happens from time to time. Looks like on first request after the service run for some time (day?) without active client access.
[255725.896783] sympasoap11.fcg[1988]: segfault at 7fe3a3db0f0c ip 00007fe3a16e877d sp 00007ffc32e846e0 error 7 in libmysqlclient.so.21.2.36[7fe3a1653000+42c000] [255725.896885] Code: 74 43 55 48 89 e5 53 48 89 fb 48 83 ec 08 48 8b 47 e8 48 8b 57 f0 8b 7f e0 48 8d 70 20 48 8d 05 39 15 88 00 48 8b 00 ff 50 20 <c7> 43 e4 ad de 00 00 48 83 c4 08 48 8d 7b e0 5b 5d e9 fd 38 f9 ff
New perlbrew build of perl 5.30.3 on alma linux 8 with mysql-*-8.0.36, DBD::mysql is 5.004
With older build and DBD::mysql 4.050 and mariadb-10.5.22 all works fine.
I tried to reproduce this, but didn't manage to do so.
Versions I used:
Script:
#!/usr/local/bin/perl
use strict;
use CGI::Fast;
use DBI;
while (my $q = CGI::Fast->new) {
print "Content-Type: text/plain\n\n";
print "Perl CGI::Fast Hello World! pid=$$\n";
my $dbh = DBI->connect("dbi:mysql:host=127.0.0.1","root","Root123@");
print "mysql client version: $dbh->{mysql_clientversion}\n";
print "mysql server version: $dbh->{mysql_serverversion}\n";
my $sth = $dbh->prepare("SELECT CONNECTION_ID();");
$sth->execute || die "Execute failed: " . $sth->errstr . "\n";
while (my $ref = $sth->fetchrow_arrayref) {
print "Result: " . $$ref[0] . "\n";
}
$sth->finish;
$dbh->do('ROLLBACK RELEASE');
$dbh->ping;
my $sth = $dbh->prepare("SELECT CONNECTION_ID();");
$sth->execute || die "Execute failed: " . $sth->errstr . "\n";
while (my $ref = $sth->fetchrow_arrayref) {
print "Result: " . $$ref[0] . "\n";
}
$sth->finish;
}
Output:
$ curl http://127.0.0.1/cgi-bin/mysql.fcgi
Perl CGI::Fast Hello World! pid=21903
mysql client version: 80035
mysql server version: 80400
Result: 36
Result: 37
We use Apache, the workload is wwsympa from https://github.com/sympa-community/sympa 6.2.72 via spawn-fcgi
I can't reproduce in a way that I can trigger the crash. It happens from time to time. Having a client connect every 5 min did not trigger but only once a day did. Looks like on first request after the service run for some time (day?) without active client access.
On the exact same perlbrew I reinstalled DBD::mysql
cpanm DBD::mysql~"<5"
and the problem was gone.
What could I provide to dig deeper?
That sounds like it would use a TCP connection for which the underlying connection was already closed by the OS.
How can we help to find the root cause? As it works with DBD::mysql <5 , what changed there related to TCP connections?
git bisect
to try and find which commit introduced this.DBI_TRACE=1
(or a higher level) ? This could give some info about what's happening.Hi!
I found that problem is reproduced when script makes second connection to another database on same server with DBI->connect_cached(...) and make some prepare and execute.
DBI->connect(...) works fine.
FreeBSD 14.1 p5-DBD-mysql-5.005 mysql80-server-8.0.35_1
@iHeadRu could you post a script to reproduce this?
DBD::mysql version
5.003
MySQL client version
mysql80-client-8.0.35 from pkg repository.
Server version
8.0.35?
Operating system version
FreeBSD 14.0-RELEASE-p5
What happened?
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275100#c10
I have problem with proposed patch to DBD-mysql 5.003 in fatscgi app.
First request - ok, but on second - SIGSEGV.
Cut from ktrace & kdump:
I have no problem with 4.050 from pkg repository or ports tree (even with small patch no problem).
Other information
No response