From modperl-return-63372-apmail-perl-modperl-archive=perl.apache.org@perl.apache.org Thu Jun 6 17:23:14 2013 Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E2412105A8 for ; Thu, 6 Jun 2013 17:23:14 +0000 (UTC) Received: (qmail 72455 invoked by uid 500); 6 Jun 2013 17:23:14 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 71837 invoked by uid 500); 6 Jun 2013 17:23:09 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 71830 invoked by uid 99); 6 Jun 2013 17:23:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 17:23:07 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of xzheng@christianbook.com designates 208.68.76.78 as permitted sender) Received: from [208.68.76.78] (HELO dmzpostal.cckh.com) (208.68.76.78) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Jun 2013 17:23:01 +0000 Received: from tigger2.cbdadmin.com ([10.10.1.140]) by dmzpostal.cckh.com (8.12.8/8.12.8) with ESMTP id r56HMcEh005665; Thu, 6 Jun 2013 13:22:38 -0400 Received: from cougar.cbdadmin.com (cougar.cbdadmin.com [10.10.1.210]) by tigger2.cbdadmin.com (8.13.8/8.13.8) with ESMTP id r56HMdYt009625; Thu, 6 Jun 2013 13:22:39 -0400 Received: from cougar.cbdadmin.com ([::1]) by cougar.cbdadmin.com ([::1]) with mapi id 14.02.0247.003; Thu, 6 Jun 2013 13:22:39 -0400 From: Xinhuan Zheng To: Perrin Harkins CC: "modperl@perl.apache.org" Subject: Re: Apache::DBI "connection lost contact" error Thread-Topic: Apache::DBI "connection lost contact" error Thread-Index: AQHOXKIh3fPzO3Xb8Uq1FtDcASri05kc5b4AgAEHJQCAAHmXgIABDDaAgAAVWYD//7/bAIAAWXsAgAAF/oCAAGH5AIABLg4AgALhmwCAAK9dgIAA5qeAgABZGoD///MOgIABnIqAgAFj5gA= Date: Thu, 6 Jun 2013 17:22:38 +0000 Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: user-agent: Microsoft-MacOutlook/14.3.4.130416 x-originating-ip: [10.10.182.55] Content-Type: multipart/alternative; boundary="_000_CDD63CF93E5AExzhengchristianbookcom_" MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org --_000_CDD63CF93E5AExzhengchristianbookcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Perrin, I think I have one more request. The database handle that is created in startup.pl needs to be really discon= nected (not overloaded disconnect) so that won't leave an idle server proce= ss running on the database side. Once it's really disconnected, the server = process can be cleaned up on the server side. For child processes, I guess they don't need to really disconnect until the= time the child exits. Thanks, - xinhuan From: Perrin Harkins > Date: Wednesday, June 5, 2013 12:08 PM To: Xinhuan Zheng > Cc: Jim Schueler >,= "modperl@perl.apache.org" > Subject: Re: Apache::DBI "connection lost contact" error On Tue, Jun 4, 2013 at 2:32 PM, Xinhuan Zheng > wrote: > I have seen in other web servers when apachectl starts, there is no "conn= ect lost contact" error but it did happen when apachectl stops. If your server does not receive constant requests, you may see this error o= n shutdown because cached database handles are being destroyed but the conn= ection to the database has already timed out. > If child process uses ping the inherited database handle and it is ping-a= ble, then the child process may use it. That'll be a problem. The debugging log you showed us makes me think that won't happen. It looks= like the handle fails immediately when used after a fork. > When child process exits, it calls rollback if AutoCommit is off, but whe= n another new child process is just born and uses its connection to send > database updates, will that rollback interfere with new child process att= empt to update database? If the same connection was being used in multiple processes, many things co= uld go wrong, including that. However, Since the connections die immediate= ly when you use them after a fork, this won't happen. > Is the rollback necessary? It's very necessary. Otherwise, if your code throws an uncaught exception = in the middle of some database work, the next request would reuse the same = handle with uncommitted changes left on it. In my opinion, this is the mos= t important thing about Apache::DBI. I understand you're worried about it. I should be able to send you a patch= to try within a few days, so you can wait for that if you want. Or you ca= n try to fix it yourself. My plan is to replace that line of code I showed= with some code that checks current_callback() to make sure we're not in a = startup phase. - Perrin --_000_CDD63CF93E5AExzhengchristianbookcom_ Content-Type: text/html; charset="us-ascii" Content-ID: <888802B85B1BEF4DA0551305AEE84B2F@cbd.com> Content-Transfer-Encoding: quoted-printable
Hi Perrin,

I think I have one more request. 

The database handle that is created in startup.pl needs to be really d= isconnected (not overloaded disconnect) so that won't leave an idle server = process running on the database side. Once it's really disconnected, the se= rver process can be cleaned up on the server side.

For child processes, I guess they don't need to really disconnect unti= l the time the child exits.

Thanks,
- xinhuan

From: Perrin Harkins <pharkins@gmail.com>
Date: Wednesday, June 5, 2013 12:08= PM
To: Xinhuan Zheng <xzheng@christianbook.com>
Cc: Jim Schueler <jschueler@eloquency.com>, "modperl@perl.apache.org" <<= a href=3D"mailto:modperl@perl.apache.org">modperl@perl.apache.org> Subject: Re: Apache::DBI "conn= ection lost contact" error

On Tue, Jun 4, 2013 at 2:32 PM, Xinhuan Zheng <xzheng@christianbook= .com> wrote:
> I have seen in other web servers when apachectl starts, there is no &q= uot;connect lost contact" error but it did happen when apachectl stops= .

If your server does not receive constant requests, you may = see this error on shutdown because cached database handles are being destro= yed but the connection to the database has already timed out.

> If child process uses ping the inherited database handle and it i= s ping-able, then the child process may use it. That'll be a problem.

The debugging log you showed us makes me think that won't happen.  It = looks like the handle fails immediately when used after a fork.

> When child process exits, it calls rollback if AutoCommit is off, but = when another new child process is just born and uses its connection to send=
> database updates, will that rollback interfere with new child pro= cess attempt to update database?

If the same connection was being used in multiple processes= , many things could go wrong, including that.  However, Since the conn= ections die immediately when you use them after a fork, this won't happen.<= /div>

> Is the rollback necessary?

It's very necessary.  Otherwise, if your code throws an uncaught excep= tion in the middle of some database work, the next request would reuse the = same handle with uncommitted changes left on it.  In my opinion, this = is the most important thing about Apache::DBI.

I understand you're worried about it.  I should be abl= e to send you a patch to try within a few days, so you can wait for that if= you want.  Or you can try to fix it yourself.  My plan is to rep= lace that line of code I showed with some code that checks current_callback() to make sure we're not in a startup phase.

- Perrin
--_000_CDD63CF93E5AExzhengchristianbookcom_--