Re: [rt.cpan.org #20648] Server side prepares fail under mod_perl

"mark-WmyhgDpj2fCHT8/[email protected] via RT" <[email protected]>
Newsgroups gmane.comp.db.postgresql.dbdpg
Message-ID <[email protected]>
       Queue: DBD-Pg
 Ticket <URL: http://rt.cpan.org/Ticket/Display.html?id=20648 >

 >>>  prepared statement "dbdpg_7" already exists

Thanks for the response.

 > I can't know what your exact issue is remotely, but all the times in the
 > past that I've encountered those errors, it has always been a case of
 > two separate processes or threads sharing the same database connection
 > (socket), for some reason or other.
 >
 > In a mod_perl situation, this could happen if your are preloading a
 > module at pre-fork time, and then the individual forked children are all
 > accessing the same connection that was created then.  The solution tends
 > to be to make sure you are disconnected from the database before forking
 > (let each child connect for itself).

In startup.pl, we load Apache::DBI, and DBI, but don't connect there.

We fork in one place in the application, but explicitly use a second
connection there, with the syntax that tells Apache::DBI not just re-use
an existing connection.

 > DBIx::Class's storage driver handles all this sort of stuff for you
 > (forking, threading, server disconnecting due to idle timeouts, etc),
 > but when using a raw DBI driver handle, you have to do this stuff 
yourself.

We are using a raw handle, so I could look at DBIx::Class is doing
differently.

I'll also try the patch which adds the current PID into the name, and
see if that helps.

Thanks again.

     Mark

-- 
http://mark.stosberg.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.