On Sun, Aug 8, 2010 at 5:08 PM, Glen Eustace wrote:
> Thanks Tom, that is pretty much the conclusion I came to. I think I need to
> close the db connection prior to the fork and then re-open in the new child.
>
Yes, you pretty much have to do this. I usually do the close
immediately after fork
The solution to my problems involved both of the issues Tom identified.
1. Proc::Daemon::Init() call closed the libpq connection in the parent.
Solution: deliberately close connection before call and open in the
child after the call.
2. The status updates were being written inside
Not on that much evidence; but trying to pass a libpq connection across
a fork is usually risky. The trouble is that both parent and child
processes now hold copies of the open socket connection, but only one of
them can safely work with it. It could be that you've closed the libpq
connection
Glen Eustace writes:
> Unfortunately your comments don't shed any light on the error I am getting;
> "could not receive data from server: Bad file descriptor".
> This suggests to me that I might have lost the connection in my forked
> perl process to the back-end. Can you confirm or deny ?
Not
Hi Tom,
On 08/09/2010 03:33 AM, Tom Lane wrote:
Your note is awfully short of concrete details, but I'm guessing the
basic reason why this wasn't working for you was you were doing all the
operations as a single transaction. The results of that transaction
wouldn't be visible to another one un
Glen Eustace writes:
> My goal is to have a perl cgi script (that is accessed using AJAX)
> perform some operations in a database using DBI. Some of the actions
> are likely to take a while so my intent was to have a table that the
> backend process periodically writes status messages into. T