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

Tim Lank <[email protected]> Sat, 12 Oct 2024 16:19:08 -0400
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAHyifnTSg9G5n4MQVfJ6rdwtgJzOE-xzmft=uDXtWxcH0j_KcQ@mail.gmail.com>
--0000000000008aaa1606244d513d
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Thanks Perrin.

The "end user" is getting the following:

HTTP/1.1 500 Internal Server Error
Date: Tue, 08 Oct 2024 20:17:24 GMT
Server: Apache/2.4.57 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12 Perl/v5.32.=
1
Content-Length: 333
Connection: close
Content-Type: text/html; charset=3Diso-8859-1

<h1>Software error:</h1>
<pre>Can't call method &quot;prepare&quot; on an undefined value at
/var/www/holidayshop/perl/validatephone.pl line 26.
</pre>
<p>
For help, please send mail to the webmaster (<a
href=3D"mailto:redacted">redacted</a>),
giving this error message
and the time and date of the error.

The version of Perl that mod_perl is using is apparently the exact same one
as is on the system.

mod_perl:  Embedded Perl version *v5.32.1*

$ perl -v

This is perl 5, version 32, subversion 1 (v5.32.1)

I'm not setting any ENV variables that I know of..  Perhaps you have some
examples of these that come to mind that might be the case?

Thanks again for your help.

On Thu, Oct 10, 2024 at 12:28=E2=80=AFPM Perrin Harkins <[email protected]=
> wrote:

> DBI is supposed to install the driver when you call connect(), although
> that does mean any code loaded there isn't shared in memory.
>
> My question would be, did you get any actual failed responses in your loa=
d
> test, or just these error log messages? If all the requests succeeded, th=
en
> I would suspect something where this code is somehow being run from the
> parent process. (Sorry if my terminology is off; I'm a mod_perl 1 user.)
>
> If not, it could be that your validatephone.pl code does fine when the
> connection is opened for it by connect_on_init(), but after a connection
> gets closed for some reason, it can't reconnect because the environment i=
s
> different. Maybe the path for shared objects is different at that point.
> I'd try to figure out what's giving it that "not initialized" text in the
> error message.
>
> Other things to consider:
> - Are your DBI/DBD modules compiled with the same Perl that mod_perl was
> compiled with?
> - Are you setting any ENV variables that might be needed by DBI/mysql and
> might not get passed through to the child process?
>
> On Thu, Oct 10, 2024 at 11:02=E2=80=AFAM Tim Lank <[email protected]> w=
rote:
>
>> Thanks Ed.  I'll add it and see if it helps.  My load testing phase is
>> already completed, but I may get a chance to retest next year.
>>
>> On Thu, Oct 10, 2024 at 6:32=E2=80=AFAM Edward J. Sabol <edwardjsabol@gm=
ail.com>
>> wrote:
>>
>>> On Oct 7, 2024, at 5:55=E2=80=AFPM, Tim Lank <[email protected]> wrot=
e:
>>>
>>> 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",
>>>
>>>
>>> I don't know if it will help or not, but, before the above lines, your
>>> startup.pl should also have the following lines:
>>>
>>> use DBI;
>>> DBI->install_driver('mysql');
>>> use Apache::DBI;
>>>
>>> Regards,
>>> Ed
>>>
>>>

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

<div dir=3D"ltr">Thanks Perrin.<div><br></div><div>The &quot;end user&quot;=
 is getting the following:</div><div><br></div><div>HTTP/1.1 500 Internal S=
erver Error<br>Date: Tue, 08 Oct 2024 20:17:24 GMT<br>Server: Apache/2.4.57=
 (AlmaLinux) OpenSSL/3.0.7 mod_perl/2.0.12 Perl/v5.32.1<br>Content-Length: =
333<br>Connection: close<br>Content-Type: text/html; charset=3Diso-8859-1<b=
r><br>&lt;h1&gt;Software error:&lt;/h1&gt;<br>&lt;pre&gt;Can&#39;t call met=
hod &amp;quot;prepare&amp;quot; on an undefined value at /var/www/holidaysh=
op/perl/<a href=3D"http://validatephone.pl">validatephone.pl</a> line 26.<b=
r>&lt;/pre&gt;<br>&lt;p&gt;<br>For help, please send mail to the webmaster =
(&lt;a href=3D&quot;mailto:<a href=3D"mailto:redacted">redacted</a>&quot;&g=
t;redacted&lt;/a&gt;), giving this error message<br>and the time and date o=
f the error.<br></div><div><br></div><div>The version of Perl that mod_perl=
 is using is apparently the exact same one as is on the system.</div><div><=
br></div><div>mod_perl:=C2=A0=C2=A0<span style=3D"color:rgb(0,0,0);font-fam=
ily:&quot;Times New Roman&quot;;font-size:medium;background-color:rgb(221,2=
21,221)">Embedded Perl version=C2=A0</span><b style=3D"color:rgb(0,0,0);fon=
t-family:&quot;Times New Roman&quot;;font-size:medium">v5.32.1</b></div><di=
v><br></div><div>$ perl -v<br><br>This is perl 5, version 32, subversion 1 =
(v5.32.1)<br></div><div><br></div><div>I&#39;m not setting any ENV variable=
s that I know of..=C2=A0 Perhaps you have some examples of these that come =
to mind that might be the case?</div><div><br></div><div>Thanks again for y=
our help.</div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Thu, Oct 10, 2024 at 12:28=E2=80=AFPM Perrin Harkins &lt=
;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br=
></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;=
border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">D=
BI is supposed to install the driver when you call connect(), although that=
 does mean any code loaded=C2=A0there isn&#39;t shared in memory.<div><br><=
/div><div>My question would be, did you get any actual failed responses in =
your load test, or just these error log messages? If all the requests succe=
eded, then I would suspect something where this code is somehow being run f=
rom the parent process. (Sorry if my terminology is off; I&#39;m a mod_perl=
 1 user.)</div><div><br></div><div>If not, it could be that your <a href=3D=
"http://validatephone.pl" target=3D"_blank">validatephone.pl</a> code does =
fine when the connection is opened for it by connect_on_init(), but after a=
 connection gets closed for some reason, it can&#39;t reconnect because the=
 environment is different. Maybe the path for shared=C2=A0objects is differ=
ent at that point. I&#39;d try to figure out what&#39;s giving it that &quo=
t;not initialized&quot; text in the error message.</div><div><br></div><div=
>Other things to consider:</div><div>- Are your DBI/DBD modules compiled wi=
th the same Perl that mod_perl was compiled with?</div><div>- Are you setti=
ng any ENV variables that might be needed by DBI/mysql and might not get pa=
ssed through to the child process?</div></div><br><div class=3D"gmail_quote=
"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Oct 10, 2024 at 11:02=E2=80=
=AFAM Tim Lank &lt;<a href=3D"mailto:[email protected]" target=3D"_blank"=
>[email protected]</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex"><div dir=3D"ltr">Thanks=C2=A0Ed.=C2=A0 I&#39;ll add it =
and see if it helps.=C2=A0 My load testing phase is already completed, but =
I may get a chance to retest next year.</div><br><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Oct 10, 2024 at 6:32=E2=80=
=AFAM Edward J. Sabol &lt;<a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a>&gt; wrote:<br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid r=
gb(204,204,204);padding-left:1ex"><div dir=3D"auto"><div dir=3D"ltr"></div>=
<div dir=3D"ltr">On Oct 7, 2024, at 5:55=E2=80=AFPM, Tim Lank &lt;<a href=
=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>&g=
t; wrote:</div><blockquote type=3D"cite" style=3D"color:rgb(0,0,0)"><div di=
r=3D"ltr"><div>I have the following in my=C2=A0<a href=3D"http://startup.pl=
/" target=3D"_blank">startup.pl</a>:</div><div><br></div><div>use CGI qw(:a=
ll);<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></div></div></blockquote><div dir=3D"ltr"><blo=
ckquote type=3D"cite">=C2=A0 (&quot;DBI:mysql:holidayshop&quot;,</blockquot=
e></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">I don&#39;t know if it =
will help or not, but, before the above lines, your <a href=3D"http://start=
up.pl" target=3D"_blank">startup.pl</a> should also have the following line=
s:</div><div dir=3D"ltr"><br></div><div dir=3D"ltr">use DBI;</div><div dir=
=3D"ltr"><div dir=3D"ltr">DBI-&gt;install_driver(&#39;mysql&#39;);</div><di=
v>use Apache::DBI;</div></div><div dir=3D"ltr"><br></div><div dir=3D"ltr">R=
egards,</div><div dir=3D"ltr">Ed</div><div dir=3D"ltr"><br></div></div></bl=
ockquote></div>
</blockquote></div>
</blockquote></div>

--0000000000008aaa1606244d513d--