Question regarding Perl, DBI, and fork()

From: Allen Landsidel <all(at)biosys(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Question regarding Perl, DBI, and fork()
Date: 2003-10-26 20:04:29
Message-ID: 6.0.0.22.0.20031026145720.0249d258@pop.hotpop.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have a job-processing backend written in perl, talking to a (of course)
postgres database. The perl app has a master process that checks the
database periodically for jobs that need processed. When there are
available jobs, it grabs some number of them (up a few hundred), and
fork()'s to create job processing processes, one per job, again up to a few
hundred.

I know the child processes inherit the db handle, as I learned the hard way
about InactiveDestroy ;) so my question is this:

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.

Relevant versions of everything are:

FreeBSD 4.8 (Tracking RELENG_4, now 4.9-RC)
PostGreSQL 7.3.4
perl 5.003 (FreeBSD default)
perl DBI 1.37
perl DBD::Pg 1.22

I'm on the list, CC directly only if you're bored. Thanks.

-Allen

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2003-10-26 20:33:29 Re: incrementing and decrementing dates by day increments programmatically
Previous Message Adam Witney 2003-10-26 15:16:54 Re: shared memory on OS X - 7.4beta4