damian keefe wrote:
I'm no software engineer, but given that it is known that some of the libraries used by DBI 'mess with' signal dispositions in apparently unknown ways, would it not make sense for DBI.pm to preserve the state of %SIG on entry and reinstate it on disconnect/END/EXIT

cheers

Damian


Hang on a minute. Firstly, we have not ascertained that the MySQL (which I now know you are using) does fiddle with SIGPIPE. Also, the example I quoted was for Oracle and to the best of my knowledge the source code for the Oracle client libraries (OCI API) are not public. We know the OCI libraries mess with signals (sometimes and it depends on the connection method) because we've traced the code with truss/strace etc and can see it not because we've seen the code.

To do what you suggest would add an overhead to every DBI method call which ends up in a DBD.

Signals in UNIX are per process (don't even talk about threads where things get real messy). Personally, I don't want DBI continually recording a signal's disposition (BTW, which one, there are loads) and restoring it/them because I want all the speed I can get and signals are not bothering me. You found a workaround but assuming the MySQL libraries do change SIGPIPE you have to ask yourself why - presumably not because a programmer just thought it would be nice without a reason. Even if the client libraries you use do fiddle with signals there are other solutions. If you are only worried about what happens after disconnect and the MySQL libraries do not restore a signal after disconnect then I could easily argue the problem is in MySQL and not DBI. If you want to use backticks etc whilst connected to MySQL then that is a different issue.

Lets find out IF and WHY the MySQL libraries do this before solving a problem no one but you seems to have.

I guess I;m saying this is not as straight forward as you think.

Martin
On 28 Jul 2010, at 19:22, Martin J. Evans wrote:

I suspect you'll find its your driver library that ignores SIGPIPE as AFAIK, DBI does not. Oracle's OCI library changes some signal dispositions for sure and sometimes SIGPIPE/SIGCHLD.

Martin

<snipped example code>


Reply via email to