Re: Apache::DBI - consistently encountering about a .00667% error rate

Mithun Bhattacharya <[email protected]> Mon, 7 Oct 2024 17:31:09 -0500
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAHTPV9LfKk3V+uGMxmXrE6QE-KDU58GOT_HDrzuubrNUpoxdxA@mail.gmail.com>
--0000000000007e34f40623ea944d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Maybe this helps ?

https://php.watch/articles/fix-php-mysql-84-mysql_native_password-not-loade=
d

On Mon, Oct 7, 2024, 4:56=E2=80=AFPM Tim Lank <[email protected]> wrote:

> Apache::DBI experts:
>
> I have the following in my 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 =3D> 1, # warn() on errors
>        RaiseError =3D> 0, # don't die on error
>        AutoCommit =3D> 1, # commit executes immediately
>     }
>   );
> $Apache::DBI::DEBUG =3D 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 line 16.
>
> The actual line #16 in the code is:
>
> my $logdb =3D DBI->connect('DBI:mysql:holidayshop', 'dba', 'theactualpw')=
;
>
> Hundreds of thousands of connections occur either outright or out of cach=
e
> 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.1Server MPM: eventServer version: 8.0.39 MySQL Community
> Server - GPL
>
> Thanks,Tim
>

--0000000000007e34f40623ea944d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">Maybe this helps ?<div dir=3D"auto"><br></div><div dir=3D=
"auto"><a href=3D"https://php.watch/articles/fix-php-mysql-84-mysql_native_=
password-not-loaded">https://php.watch/articles/fix-php-mysql-84-mysql_nati=
ve_password-not-loaded</a><br></div></div><br><div class=3D"gmail_quote"><d=
iv dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 7, 2024, 4:56=E2=80=AFPM Ti=
m Lank &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&g=
t; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0p=
x 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div d=
ir=3D"ltr"><div>Apache::DBI experts:</div><div><br></div><div>I have the fo=
llowing in my <a href=3D"http://startup.pl" target=3D"_blank" rel=3D"norefe=
rrer">startup.pl</a>:</div><div><br></div><div>use CGI qw(:all);<br>use CGI=
::Carp &#39;fatalsToBrowser&#39;, &#39;carpout&#39;;<br>use List::Util &#39=
;shuffle&#39;;<br>CGI-&gt;compile(&#39;:all&#39;);<br>Apache::DBI-&gt;conne=
ct_on_init<br>=C2=A0 (&quot;DBI:mysql:holidayshop&quot;,<br>=C2=A0 =C2=A0 =
=C2=A0&quot;dba&quot;,<br>=C2=A0 =C2=A0 =C2=A0&quot;theactualpw&quot;,<br>=
=C2=A0 =C2=A0 {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0PrintError =3D&gt; 1, # warn(=
) on errors<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0RaiseError =3D&gt; 0, # don&#39;t=
 die on error<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0AutoCommit =3D&gt; 1, # commit =
executes immediately<br>=C2=A0 =C2=A0 }<br>=C2=A0 );<br>$Apache::DBI::DEBUG=
 =3D 0;<br>1;<br></div><div><br></div><div>mysql&gt; SHOW VARIABLES LIKE &#=
39;wait_%&#39;;<br>+---------------+-------+<br>| Variable_name | Value |<b=
r>+---------------+-------+<br>| wait_timeout =C2=A0| 300 =C2=A0 |=C2=A0 =
=C2=A0 (I have set this to 172800 as well, but it somehow doesn&#39;t stick=
)<br>+---------------+-------+<br>1 row in set (0.01 sec)<br><br>mysql&gt; =
SHOW global VARIABLES LIKE &#39;wait_%&#39;;<br>+---------------+--------+<=
br>| Variable_name | Value =C2=A0|<br>+---------------+--------+<br>| wait_=
timeout =C2=A0| 172800 |<br>+---------------+--------+<br>1 row in set (0.0=
0 sec)<br><br>mysql&gt; SHOW session VARIABLES LIKE &#39;wait_%&#39;;<br>+-=
--------------+-------+<br>| Variable_name | Value |<br>+---------------+--=
-----+<br>| wait_timeout =C2=A0| 300 =C2=A0 |=C2=A0 =C2=A0 =C2=A0

(I have set this to 172800 as well, but it somehow doesn&#39;t stick)<br>+-=
--------------+-------+<br>1 row in set (0.00 sec)<br></div><div><br></div>=
<div><br></div><div>I am load testing by sending about 300 page requests th=
at utilize the database every minute or so for the period of an hour.</div>=
<div><br></div><div>Consistently I see about 6-8 occurrences of the followi=
ng error in my Apache error log for the hour no matter what I seem to do:</=
div><div><br></div><div>=C2=A0-e: DBI connect(&#39;holidayshop&#39;,&#39;db=
a&#39;,...) failed: Authentication plugin &#39;mysql_native_password&#39; c=
annot be loaded: not initialized at /var/www/holidayshop/perl/<a href=3D"ht=
tp://validatephone.pl" target=3D"_blank" rel=3D"noreferrer">validatephone.p=
l</a> line 16.<br></div><div><br></div><div>The actual line #16 in the code=
 is:</div><div><br></div><div>my $logdb =3D DBI-&gt;connect(&#39;DBI:mysql:=
holidayshop&#39;, &#39;dba&#39;, &#39;theactualpw&#39;);<br></div><div><br>=
</div><div>Hundreds of thousands of connections occur either outright or ou=
t of cache without error and work just fine.=C2=A0 =C2=A0The only problem i=
s these 6-8 errors in the log.</div><div><br></div><div>Can someone clue me=
 in on what to do in order to try and eliminate any of the errors from happ=
ening when doing a load test like this?</div><div><br></div><div><dt style=
=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medi=
um">Server Version: Apache/2.4.57 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12=
 Perl/v5.32.1</dt><dt style=3D"color:rgb(0,0,0);font-family:&quot;Times New=
 Roman&quot;;font-size:medium">Server MPM: event</dt><dt style=3D"color:rgb=
(0,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium">Server ve=
rsion: 8.0.39 MySQL Community Server - GPL<br></dt><dt style=3D"color:rgb(0=
,0,0);font-family:&quot;Times New Roman&quot;;font-size:medium"><br></dt><d=
t style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;font-si=
ze:medium">Thanks,</dt><dt style=3D"color:rgb(0,0,0);font-family:&quot;Time=
s New Roman&quot;;font-size:medium">Tim</dt></div></div>
</blockquote></div>

--0000000000007e34f40623ea944d--