Re: Apache::DBI "connection lost contact" error

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAC0_be2UXRLRu6aWQXRE7wC2U2+axwrwnBNp=Dute51gXY2OEg@mail.gmail.com>
Well, you are on the modperl list, so that means you. :)

Xinhuan, the error is harmless, but if you're concerned about it I would
try turning on debugging to make sure the connection is not being cached.
 Do this:
$Apache::DBI::DEBUG = 2;

And then watch for a message like this in your log:
skipping connection during server startup

- Perrin


On Fri, May 31, 2013 at 10:33 AM, Jim Schueler <[email protected]>wrote:

> I'm afraid I'm out of my league.  I just noticed the following comment on
> the Apache::DBI man page:
>
>   Edmund Mergl was the original author of Apache::DBI. It is now supported
>   and maintained by the modperl mailinglist, see the mod_perl documentation
>   for instructions on how to subscribe.
>
>  -Jim
>
>
> On Fri, 31 May 2013, Xinhuan Zheng wrote:
>
>  I believe I am using "my" declaration rather than "local". I also tried
>> explicitly disconnect but still have same issue. Since it only happens in
>> parent/child processes, I don't know a good way to debug parent/child, nor
>> reproducing the same error using a simple program. Can you guys help me
>> with that?
>>
>> Thanks,
>> - xinhuan
>>
>> On 5/31/13 9:02 AM, "Jim Schueler" <[email protected]> wrote:
>>
>>  Perrin is right.  But fundamentally, I'd say that you're confusing
>>> 'local' and 'my' variable scoping:
>>>
>>>    http://www.perlmonks.org/?**node_id=94007<http://www.perlmonks.org/?node_id=94007>
>>>
>>>  -Jim
>>>
>>> On Fri, 31 May 2013, Perrin Harkins wrote:
>>>
>>>  Try an explicit disconnect() call.
>>>> - Perrin
>>>>
>>>>
>>>> On Thu, May 30, 2013 at 7:46 PM, Xinhuan Zheng
>>>> <[email protected]>
>>>> wrote:
>>>>       The db handle is declared local and once it's out of scope, the
>>>>       destroy
>>>>       call will disconnect. But it appears even though variable is out
>>>>       of scope,
>>>>       we still get that error. Don't know why.
>>>>       - xinhuan
>>>>
>>>>       On 5/30/13 8:31 AM, "Jim Schueler" <[email protected]>
>>>>       wrote:
>>>>
>>>>      >Did this solve your problem?
>>>>      >
>>>>      >  -Jim
>>>>      >
>>>>      >On Wed, 29 May 2013, Perrin Harkins wrote:
>>>>      >
>>>>      >> Hi,
>>>>      >> Apache::DBI is supposed to skip caching if you connect during
>>>>       startup.
>>>>      >>You
>>>>      >> should just need to disconnect your database handle after you
>>>>       finish
>>>>      >>with
>>>>      >> it.  It sounds like you're opening it and then leaving it
>>>>       open.
>>>>      >>
>>>>      >> - Perrin
>>>>      >>
>>>>      >>
>>>>      >> On Wed, May 29, 2013 at 3:24 PM, Xinhuan Zheng
>>>>      >><[email protected]>
>>>>      >> wrote:
>>>>      >>       Hi,
>>>>      >>
>>>>      >> I have apache 2.2.23 statically compiled with mod_perl2
>>>>       (prefork).
>>>>      >> perl binary is 5.10.1. In startup.pl file there is call
>>>>      >> Apache::DBI->connect_on_init.
>>>>      >>
>>>>      >> <code>
>>>>      >> use Apache::DBI;
>>>>      >> Apache::DBI->connect_on_init( $DB_DRIVER, $DB_USER,
>>>>       $DB_PASSWORD );
>>>>      >>
>>>>      >> use DBI;
>>>>      >> </code>
>>>>      >>
>>>>      >> I need to call DBI->connect to load some data during server
>>>>       startup
>>>>      >> stage. There is problem with this setup. Whenever apachectl
>>>>      >> startup/shutdown, we got connection error like this:
>>>>      >>
>>>>      >> DBD::Oracle::db DESTROY failed: ORA-03135: connection lost
>>>>       contact
>>>>      >> Process ID: 0
>>>>      >> Session ID: 3252 Serial number: 15131 (DBD ERROR:
>>>>       OCISessionEnd) at
>>>>      >> /usr/local/lib/perl5/site_**perl/5.10.1/Apache/DBI.pm line 228.
>>>>      >>
>>>>      >> I am trying to fix this error. I think it's related to
>>>>       DBI->connect
>>>>      >> in startup.pl. My question is:
>>>>      >>  1. How do I accomplish loading data into database during
>>>>       server
>>>>      >>     startup using Apache::DBI?
>>>>      >>  2. Once data is loaded during server startup, how do I
>>>>       safely destroy
>>>>      >>     this database handle but not affect the children
>>>>       instantiate their
>>>>      >>     database handles?
>>>>      >> Thanks in advance,
>>>>      >>
>>>>      >> Xinhuan
>>>>      >>
>>>>      >>
>>>>      >>
>>>>
>>>>
>>>>
>>>>
>>
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.