Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: On timing out with ALRM

by samtregar (Abbot)
on Jul 25, 2007 at 17:00 UTC ( #628728=note: print w/ replies, xml ) Need Help??


in reply to On timing out with ALRM

This is quite similar to the problem I solved with DBIx::Timeout. In that case I needed to timeout long DB queries but I couldn't rely on signals to do it safely. My solution was to fork off a process that waits until the timeout occurs and then kills the DB connection. In your case you'd probably have to fork the long-running code and then end it with kill(). It's not what you'd call a light-weight solution but it should work...

Of course, an alternative would be to fix the code! Evals that throws away errors are really worth the time to fix. I've been bitten by that beast more than once while working on inherited code and it's amazing how much work they can cause when error messages for relatively simple problems just aren't getting to the error logs!

-sam


Comment on Re: On timing out with ALRM

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://628728]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2014-12-25 02:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls