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

Tim Lank <[email protected]> Thu, 10 Oct 2024 05:47:37 -0400
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAHyifnTEjUHgLmbig0QidjsoW72tVxmjJkkps-cXRMv9hdYAuw@mail.gmail.com>
--00000000000066c52006241c4346
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Nothing glaring turned up in the logs when DBI debugs were turned on.

Along the lines of what Mithun conveyed, I did add this to the /etc/my.cnf
and it has seemed to cut the amount of errors in half or less from 6-8 down
to 2 or 3 per run.

[mysqld]
default-authentication-plugin=3Dmysql_native_password

Ref:
https://dev.mysql.com/blog-archive/upgrading-to-mysql-8-0-default-authentic=
ation-plugin-considerations/


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

> Good point.  I=E2=80=99ll try to ratchet up the debugs on those to see if=
 anything
> pops out
>
> On Mon, Oct 7, 2024 at 6:58=E2=80=AFPM Adam Prime <[email protected]=
to.ca>
> wrote:
>
>> 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 c=
an
>> really do is look at the code and make educated guesses.
>>
>> Adam
>>
>> On Oct 7, 2024, at 5:56=E2=80=AFPM, Tim Lank <[email protected]> wrote=
:
>>
>> =EF=BB=BF
>>
>> You don't often get email from [email protected]. Learn why this is
>> important <https://aka.ms/LearnAboutSenderIdentification>
>>
>> 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 i=
t
>> 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
>> 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 o=
f
>> 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
>>
>>

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

<div dir=3D"ltr">Nothing glaring turned up in the logs when DBI debugs were=
 turned on.<div><br></div><div>Along the lines of what Mithun conveyed, I d=
id add this to the /etc/my.cnf and it has seemed to cut the amount of error=
s in half or less from 6-8 down to 2 or 3 per run.</div><div><br></div><div=
>[mysqld]<br>default-authentication-plugin=3Dmysql_native_password<br></div=
><div><br></div><div>Ref:=C2=A0 <a href=3D"https://dev.mysql.com/blog-archi=
ve/upgrading-to-mysql-8-0-default-authentication-plugin-considerations/">ht=
tps://dev.mysql.com/blog-archive/upgrading-to-mysql-8-0-default-authenticat=
ion-plugin-considerations/</a><br></div><div><br></div></div><br><div class=
=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 7, 2024 =
at 7:28=E2=80=AFPM Tim Lank &lt;<a href=3D"mailto:[email protected]">timl=
[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad=
ding-left:1ex"><div dir=3D"auto">Good point.=C2=A0 I=E2=80=99ll try to ratc=
het up the debugs on those to see if anything pops out</div><div><br><div c=
lass=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Mon, Oct 7, 2=
024 at 6:58=E2=80=AFPM Adam Prime &lt;<a href=3D"mailto:[email protected]=
ronto.ca" target=3D"_blank">[email protected]</a>&gt; wrote:<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">



<div dir=3D"auto">
<div dir=3D"ltr"></div>
<div dir=3D"ltr">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 w=
e can really do is look at the code
 and make educated guesses.=C2=A0</div>
<div dir=3D"ltr"><br>
</div>
<div dir=3D"ltr">Adam</div>
<div dir=3D"ltr"><br>
<blockquote type=3D"cite">On Oct 7, 2024, at 5:56=E2=80=AFPM, Tim Lank &lt;=
<a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]=
m</a>&gt; wrote:<br>
<br>
</blockquote>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">=EF=BB=BF
<table border=3D"0" cellspacing=3D"0" cellpadding=3D"0" width=3D"100%" styl=
e=3D"background:revert;color:revert;direction:revert;font-size:revert;heigh=
t:revert;letter-spacing:revert;line-height:revert;margin:revert;opacity:rev=
ert;outline:revert;overflow:revert;padding:revert;text-align:revert;text-in=
dent:revert;text-orientation:revert;text-overflow:revert;text-transform:rev=
ert;vertical-align:revert;white-space:revert;word-break:revert;word-spacing=
:revert;writing-mode:revert;zoom:revert;border:0px;display:table;width:100%=
;table-layout:fixed;float:none;border-spacing:0px" align=3D"left">
<tbody style=3D"background:revert;border:revert;color:revert;direction:reve=
rt;font-size:revert;height:revert;letter-spacing:revert;line-height:revert;=
margin:revert;opacity:revert;outline:revert;overflow:revert;padding:revert;=
table-layout:revert;text-align:revert;text-indent:revert;text-orientation:r=
evert;text-overflow:revert;text-transform:revert;vertical-align:revert;whit=
e-space:revert;width:revert;word-break:revert;word-spacing:revert;writing-m=
ode:revert;zoom:revert;display:block">
<tr style=3D"background:revert;border:revert;color:revert;direction:revert;=
display:revert;font-size:revert;height:revert;letter-spacing:revert;line-he=
ight:revert;margin:revert;opacity:revert;outline:revert;overflow:revert;pad=
ding:revert;table-layout:revert;text-align:revert;text-indent:revert;text-o=
rientation:revert;text-overflow:revert;text-transform:revert;vertical-align=
:revert;white-space:revert;width:revert;word-break:revert;word-spacing:reve=
rt;writing-mode:revert;zoom:revert">
<td valign=3D"middle" width=3D"1px" bgcolor=3D"#A6A6A6" cellpadding=3D"7px =
2px 7px 2px" style=3D"background-image:revert;background-position:revert;ba=
ckground-size:revert;background-repeat:revert;background-origin:revert;back=
ground-clip:revert;border:revert;color:revert;direction:revert;display:reve=
rt;font-size:revert;height:revert;letter-spacing:revert;line-height:revert;=
margin:revert;opacity:revert;outline:revert;overflow:revert;table-layout:re=
vert;text-align:revert;text-indent:revert;text-orientation:revert;text-over=
flow:revert;text-transform:revert;vertical-align:revert;white-space:revert;=
word-break:revert;word-spacing:revert;writing-mode:revert;zoom:revert;paddi=
ng:7px 2px;background-color:rgb(166,166,166);width:0px">
</td>
<td valign=3D"middle" width=3D"100%" bgcolor=3D"#EAEAEA" cellpadding=3D"7px=
 5px 7px 15px" color=3D"#212121" style=3D"background-image:revert;backgroun=
d-position:revert;background-size:revert;background-repeat:revert;backgroun=
d-origin:revert;background-clip:revert;border:revert;direction:revert;displ=
ay:revert;height:revert;letter-spacing:revert;line-height:revert;margin:rev=
ert;opacity:revert;outline:revert;overflow:revert;table-layout:revert;text-=
indent:revert;text-orientation:revert;text-overflow:revert;text-transform:r=
evert;vertical-align:revert;white-space:revert;word-break:revert;word-spaci=
ng:revert;writing-mode:revert;zoom:revert;width:100%;background-color:rgb(2=
34,234,234);padding:7px 5px 7px 15px;font-family:wf_segoe-ui_normal,&quot;S=
egoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif;font-size:12px;f=
ont-weight:normal;color:rgb(33,33,33);text-align:left">
<div style=3D"background:revert;border:revert;color:revert;direction:revert=
;display:revert;font-size:revert;height:revert;letter-spacing:revert;line-h=
eight:revert;margin:revert;opacity:revert;outline:revert;overflow:revert;pa=
dding:revert;table-layout:revert;text-align:revert;text-indent:revert;text-=
orientation:revert;text-overflow:revert;text-transform:revert;vertical-alig=
n:revert;white-space:revert;width:revert;word-break:revert;word-spacing:rev=
ert;writing-mode:revert;zoom:revert">
You don&#39;t often get email from <a href=3D"mailto:[email protected]" t=
arget=3D"_blank">[email protected]</a>. <a href=3D"https://aka.ms/LearnAb=
outSenderIdentification" style=3D"background:revert;color:revert;direction:=
revert;display:revert;font-size:revert;opacity:revert" target=3D"_blank">
Learn why this is important</a> </div>
</td>
<td valign=3D"middle" align=3D"left" width=3D"75px" bgcolor=3D"#EAEAEA" cel=
lpadding=3D"7px 5px 7px 5px" color=3D"#212121" style=3D"background-image:re=
vert;background-position:revert;background-size:revert;background-repeat:re=
vert;background-origin:revert;background-clip:revert;border:revert;directio=
n:revert;display:revert;height:revert;letter-spacing:revert;line-height:rev=
ert;margin:revert;opacity:revert;outline:revert;overflow:revert;table-layou=
t:revert;text-indent:revert;text-orientation:revert;text-overflow:revert;te=
xt-transform:revert;vertical-align:revert;white-space:revert;word-break:rev=
ert;word-spacing:revert;writing-mode:revert;zoom:revert;width:75px;backgrou=
nd-color:rgb(234,234,234);padding:7px 5px;font-family:wf_segoe-ui_normal,&q=
uot;Segoe UI&quot;,&quot;Segoe WP&quot;,Tahoma,Arial,sans-serif;font-size:1=
2px;font-weight:normal;color:rgb(33,33,33);text-align:left">
</td>
</tr>
</tbody>
</table></div></blockquote></div><div dir=3D"auto"><blockquote type=3D"cite=
"><div dir=3D"ltr">
<div>
<div dir=3D"ltr">
<div>Apache::DBI experts:</div>
<div><br>
</div>
<div>I have the following in my <a href=3D"http://startup.pl" target=3D"_bl=
ank">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;connect_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<b=
r>
=C2=A0 =C2=A0 =C2=A0 =C2=A0AutoCommit =3D&gt; 1, # commit executes immediat=
ely<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 |<br>
+---------------+-------+<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.00 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 that 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 following 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;dba&#39;,...) failed:=
 Authentication plugin &#39;mysql_native_password&#39; cannot be loaded: no=
t initialized at /var/www/holidayshop/perl/<a href=3D"http://validatephone.=
pl" target=3D"_blank">validatephone.pl</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;db=
a&#39;, &#39;theactualpw&#39;);<br>
</div>
<div><br>
</div>
<div>Hundreds of thousands of connections occur either outright or out of c=
ache without error and work just fine.=C2=A0 =C2=A0The only problem is thes=
e 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 happening when doing a load test like this?</div>
<div><br>
</div>
<div><dl><dt style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&qu=
ot;;font-size:medium">
Server Version: Apache/2.4.57 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12 Per=
l/v5.32.1</dt><dt style=3D"color:rgb(0,0,0);font-family:&quot;Times New Rom=
an&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 versio=
n: 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><dt style=3D"color:rgb(0,0,0);font-family:&quot;Times New Roman&quot;;=
font-size:medium">Thanks,</dt><dt style=3D"color:rgb(0,0,0);font-family:&qu=
ot;Times New Roman&quot;;font-size:medium">Tim</dt></dl></div>
</div>
</div>
</div>
</blockquote>
</div>

</blockquote></div></div>
</blockquote></div>

--00000000000066c52006241c4346--