You may need to dig into the code in DBI, or DBD::mysql to understand what is 
happening (or not happening) in the rare occasions that this occurs. Without 
the ability to consistently reproduce the issue all we can really do is look at 
the code and make educated guesses.

Adam

On Oct 7, 2024, at 5:56 PM, Tim Lank <timl...@timlank.com> wrote:


You don't often get email from timl...@timlank.com. Learn why this is 
important<https://aka.ms/LearnAboutSenderIdentification>
Apache::DBI experts:

I have the following in my startup.pl<http://startup.pl>:

use CGI qw(:all);
use CGI::Carp 'fatalsToBrowser', 'carpout';
use List::Util 'shuffle';
CGI->compile(':all');
Apache::DBI->connect_on_init
  ("DBI:mysql:holidayshop",
     "dba",
     "theactualpw",
    {
       PrintError => 1, # warn() on errors
       RaiseError => 0, # don't die on error
       AutoCommit => 1, # commit executes immediately
    }
  );
$Apache::DBI::DEBUG = 0;
1;

mysql> SHOW VARIABLES LIKE 'wait_%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 300   |    (I have set this to 172800 as well, but it somehow 
doesn't stick)
+---------------+-------+
1 row in set (0.01 sec)

mysql> SHOW global VARIABLES LIKE 'wait_%';
+---------------+--------+
| Variable_name | Value  |
+---------------+--------+
| wait_timeout  | 172800 |
+---------------+--------+
1 row in set (0.00 sec)

mysql> SHOW session VARIABLES LIKE 'wait_%';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 300   |      (I have set this to 172800 as well, but it 
somehow doesn't stick)
+---------------+-------+
1 row in set (0.00 sec)


I am load testing by sending about 300 page requests that utilize the database 
every minute or so for the period of an hour.

Consistently I see about 6-8 occurrences of the following error in my Apache 
error log for the hour no matter what I seem to do:

 -e: DBI connect('holidayshop','dba',...) failed: Authentication plugin 
'mysql_native_password' cannot be loaded: not initialized at 
/var/www/holidayshop/perl/validatephone.pl<http://validatephone.pl> line 16.

The actual line #16 in the code is:

my $logdb = DBI->connect('DBI:mysql:holidayshop', 'dba', 'theactualpw');

Hundreds of thousands of connections occur either outright or out of cache 
without error and work just fine.   The only problem is these 6-8 errors in the 
log.

Can someone clue me in on what to do in order to try and eliminate any of the 
errors from happening when doing a load test like this?

Server Version: Apache/2.4.57 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12 
Perl/v5.32.1
Server MPM: event
Server version: 8.0.39 MySQL Community Server - GPL

Thanks,
Tim

Reply via email to