logo       

Re: mod_perl + Apache 1.3.28: msg#00076

Subject: Re: mod_perl + Apache 1.3.28
David Wheeler wrote:
Hi All,

I just ran into some very strange issues with connections to a PostgreSQL database (using DBD::Pg) getting unceremoniously dropped by my mod_perl application. I was getting error messages such as these:

[Tue Jul 22 13:21:44 2003] [error] [client 207.172.11.148] Unable to turn AutoCommit off: DBD driver has not implemented the AutoCommit attribute at /usr/local/lib/perl5/site_perl/5.8.0/Bric/Util/DBI.pm line 528, <GEN71> line 57.

Database handle destroyed without explicit disconnect at /usr/local/lib/perl5/site_perl/5.8.0/Bric/Util/DBI.pm line 1661. Database handle destroyed without explicit disconnect at /usr/local/lib/perl5/site_perl/5.8.0/Bric/Util/DBI.pm line 1661. commit ineffective with AutoCommit enabled at /usr/local/lib/perl5/site_perl/5.8.0/Bric/Util/DBI.pm line 571. Database handle destroyed without explicit disconnect at /usr/local/lib/perl5/site_perl/5.8.0/Bric/Util/DBI.pm line 1661.

The PostgreSQL log had these errors:

FATAL:  Socket command type H unknown
FATAL:  Socket command type 0 unknown
LOG:  pq_flush: send() failed: Broken pipe

After a great deal of experimentation and recompilation, I finally identified Apache 1.3.28 as the culprit. When I reverted to 1.3.27, the problem went away.

I had a look at the Apache changelog to see what might have caused this issue in Apache 1.3.28, and the most relevant item I found was this:

  *) Certain 3rd party modules would bypass the Apache API and not
     invoke ap_cleanup_for_exec() before creating sub-processes.
     To such a child process, Apache's file descriptors (lock
     fd's, log files, sockets) were accessible, allowing them
     direct access to Apache log file etc.  Where the OS allows,
     we now add proactive close functions to prevent these file
     descriptors from leaking to the child processes.
     [Jim Jagielski, Martin Kraemer]

Now it's possible that this affects mod_perl and its connections to PostgreSQL, though I have no idea how. Could it be that mod_perl is one of the 3rd party modules that's breaking this rule? Or could it be some other change that led to this problem?

Note that although I replicated this problem on FreeBSD and on Mac OS X (and had a report of the same issue from a Solaris user) with mod_perl 1.28 and 1.27, it disappeared when I ran Apache in single-process mode. I'm guessing that the problem is with either a) Apache (ack!); b) The way Apache binds mod_perl (I've got mod_perl 1.x statically compiled against Apache 1.3.x, of course); or c) Something to do with the way DBI or DBD::Pg does something. My guess is b, but wouldn't rule out a; c would be pretty strange.

At any rate, does anyone have any idea what could be causing problems such as these?

How does it behave under mod_cgi? if it's possible to write a test case to be run-able under mod_cgi.

How mod_perl is related to running subprocesses?

Does your app spawn a subprocess? Apache::SubProcess provides the cleanup_for_exec() perl API if you do. It's also documented in the mp1 guide.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxxxxxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe