Re: Question regarding Perl, DBI, and fork()

From: Robert Creager <Robert_Creager(at)LogicalChaos(dot)org>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Allen Landsidel <all(at)biosys(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Question regarding Perl, DBI, and fork()
Date: 2003-10-27 00:44:38
Message-ID: 20031026174438.1201c4b1.Robert_Creager@LogicalChaos.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

When grilled further on (Mon, 27 Oct 2003 09:40:40 +1100),
Martijn van Oosterhout <kleptog(at)svana(dot)org> confessed:

> On Sun, Oct 26, 2003 at 03:04:29PM -0500, Allen Landsidel wrote:
> > Can the children (safely) use this handle to run database queries, or
> > should I just consider the handle garbage? I didn't want to "just try and
> > see" because there's always the possibility it could work "by accident"
> > during the low-load testing, and fail at some other time.
>
> No, you can't. Even multithread programs can't use the same connection at
> the same time (they can if serialised or if they use different connections).
>
> Now, getting rid of the handle without it closing the connection would be a
> trick.

I've had good success setting InactiveDestroy (as Allen found), and in my
children, I re-connect to the db. Works for me, although I'm only using up to
16 children + parent.

Cheers,
Rob

--
17:35:03 up 86 days, 10:58, 4 users, load average: 2.09, 2.04, 2.00

In response to

Browse pgsql-general by date

  From Date Subject
Next Message John DeSoi 2003-10-27 03:17:50 Re: shared memory on OS X - 7.4beta4
Previous Message Oliver Kohll 2003-10-27 00:13:06 Re: Retrieving a column comment