Skip Menu |
 

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 83017
Status: rejected
Priority: 0/
Queue: DBD-Pg

People
Owner: Nobody in particular
Requestors: purification [...] ukr.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: [FEATURE REQUEST] DBD::Pg $sth with server-side prepares fails when executed in forked process due to unreliable prepare_name scheme
Date: Tue, 29 Jan 2013 00:13:37 +0200
To: bug-DBD-Pg [...] rt.cpan.org
From: retaliation <purification [...] ukr.net>
Download (untitled) / with headers
text/plain 583b
When $sth is prepared inside a forked process, and then executed multiple times in a forked processes, it fails in a second and all next calls due to forked process producing the same prepare_name. The current code is as follows: /* Name is "dbdpg_xPID_#", where x is 'p'ositive or 'n'egative */ sprintf(imp_sth->prepare_name,"dbdpg_%c%d_%d", (imp_dbh->pid_number < 0 ? 'n' : 'p'), abs(imp_dbh->pid_number), imp_dbh->prepare_number); I think it would be better if this code was replaced with a reliable scheme, for example UUID-based.
Download (untitled) / with headers
text/plain 164b
Not sure I understand - wouldn't forking create other problems? One cannot fork active database connections, as the messages will start interfering with each other.
Download (untitled) / with headers
text/plain 190b
DBI handles do not work across forks. Use something like DBIx::Connector to get around that -- but even still, you cannot prepare a statement handle in one process and execute it in another.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.