Re: Question regarding Perl, DBI, and fork() - Mailing list pgsql-general

From Robert Creager
Subject Re: Question regarding Perl, DBI, and fork()
Date
Msg-id 20031026174438.1201c4b1.Robert_Creager@LogicalChaos.org
Whole thread Raw
In response to Re: Question regarding Perl, DBI, and fork()  (Martijn van Oosterhout <kleptog@svana.org>)
List pgsql-general
When grilled further on (Mon, 27 Oct 2003 09:40:40 +1100),
Martijn van Oosterhout <kleptog@svana.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

Attachment

pgsql-general by date:

Previous
From: Adam Witney
Date:
Subject: Re: shared memory on OS X - 7.4beta4
Next
From: "Gerard M. Operana"
Date:
Subject: foxpro to postgresql7.1