Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Unsafe signals are called "Unsafe" for a reason, you know

by chip (Curate)
on Mar 19, 2004 at 18:04 UTC ( [id://338092]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Re: Re: Re: Re: Upgrading Perl in production environment
in thread Upgrading Perl in production environment

You just don't get it.

It is never safe to use unsafe signals. You don't know what will happen. You can't be sure that when things go wrong you'll get a SEGV and program death, allowing for cleanup. You don't know what will happen. Nobody knows. Nobody can predict what an unsafe signal will cause. Nobody! That's what makes them "unsafe"!

(What frame of mind is required for someone to think that it's safe to use a feature called "unsafe signals"? I can't fathom it, I just can't.)

    -- Chip Salzenberg, Free-Floating Agent of Chaos

  • Comment on Unsafe signals are called "Unsafe" for a reason, you know

Replies are listed 'Best First'.
Re: Unsafe signals are called "Unsafe" for a reason, you know
by jfroebe (Parson) on Mar 19, 2004 at 18:13 UTC
    Actually I do understand your point of view... and agree with you for the most part.

    even if the process goes into lala land, a separate process will kill it, start a new process which will examine what was done, undo whatever was 'messed up', and continue with the task. The overall effect would be no worse than performing kill -SIGKILL (-9).

    However, if I just wrote a routine to restart the system call without any other failsafe in place, then that would be bad and irresponsible.

    For most tasks, the unsafe signals are undesirable.. on certain tasks, they are unavoidable and necessary. The fact that they are unsafe is a failure of the Perl engine... so we have to make do, for now, with what we have and build contingency plans for using the unsafe signals.

      What you so blithely describe as "lala land" is undefined behavior. It could be anything, including something incredibly destructive. It could be jumping into &main::destroy_all_monsters. It could be calling system("rm -rf $HOME"). It could be anything. (Get the point yet? No?)

      That is why it unsafe signal handling is called "unsafe", and that is why there is NO situation in this particular universe where it is acceptable. At all. Ever. No exceptions.

      Got it? No? Oh well. I'm giving up on educating you. But I was serious about wanting to know where that financial program is that uses unsafe signals. I really don't my money there. I'm totally serious about that.

          -- Chip Salzenberg, Free-Floating Agent of Chaos

        Actually, I completely understand the ramifications of using the unsafe signals...

        Making a blanket statement is not necessarily wise... there are almost always exceptions to the rule.

        The fact remains that there are instances where the unsafe signals are required (say for timeouts involving DBD::Oracle). Avoiding the unsafe signals should be done when possible, when it is unavoidable, prepare for the worst.

        The perl engine should be fixed to make these 'unsafe' signals to be 'safe' (other engines are able to do this... so I see no reason why the perl engine can not be fixed).

        Until that happens, we will have to use unsafe signals when absolutely necessary and when there is no other option.

        Once again, the 'trading systems' was just an example of short maintenance windows.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-23 21:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found