bmdhacks has asked for the wisdom of the Perl Monks concerning the following question:
I'm running across an odd situation in a web application in mod_perl using DBD::Pg and calling system().
From packet traces on loopback, I've determined that STDOUT from my calls to system() is getting mapped to the Pg client socket and is sent to the postgres server. This makes postgresql freak and drop all of my database connections. So, if I have a code path like this:
sub foo { $dbh->begin(); my $bar = select_some_stuff_from_pgsql($dbh); my $ret = system("echo This gets written to stdout"); insert_some_stuff_into_pgsql($dbh); $dbh->commit(); }
my call to system totall hoses the transaction. So my question is... Has anyone seen this behavior before? How do I stop mod_perl from mapping stdout to my pgsql control socket? Is there some way to map stdout to something different *only* in system calls in mod_perl?
For a bit of clarification on what I'm talking about.. here's a snippet from tethereal on loopback:
26 3.393679 127.0.0.1 -> 127.0.0.1 POSTGRESQL Request This is + written to stdout... llamas 27 3.394063 127.0.0.1 -> 127.0.0.1 POSTGRESQL Response USFATA +L C08P01 Minvalid frontend message type 84 Fpostgres.c L366 RSocketBa +ckend
Thanks for any help anyone can provide.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: mod_perl + system + stdout + DBD::Pg
by Anonymous Monk on Mar 22, 2005 at 18:18 UTC |