Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^4: a few clarifications

by cosmicperl (Chaplain)
on Nov 02, 2004 at 15:52 UTC ( #404646=note: print w/replies, xml ) Need Help??

in reply to Re^3: a few clarifications
in thread Win32 Hosting companies not supporting Perl

Yes that's what I'm saying. IIS opens perl, but it's perl that actually takes down the server. Hosting companies don't care who's to blame, or who fixes the problem as long as then don't have to lift a finger. They just care right now that the problem exists, and they are avoiding perl because of it. If you give people guns you should monitor where they shoot them. Is this the American "If everyone has a gun, no one will get shot" theory coming out. If your going to give people guns (perl) then you should stop them from killing people (taking down server).

A similar problem exists with apache, as long as the user clicks there stop button.

Microsoft are never going to fix the problem. So the Perl community will have to. I'm happy enough to develop a solution myself. But I would need a little help as I don't know where in Perl I would need to make changes, or even where to submit. I guess P5P.

Replies are listed 'Best First'.
Re^5: a few clarifications
by Elian (Parson) on Nov 02, 2004 at 20:32 UTC
    A similar problem exists with apache, as long as the user clicks there stop button.
    When running in a CGI environment this turns out not to be the case. Apache can, and will if you tell it, limit the total amount of CPU time a spawned CGI process can take. IIS has a similar setting, I'm sure, and I've no doubt microsoft already has a similar solution. There's nothing for perl to do here.

    In a more embedded situation, such as mod_perl under Apache or the IIS equivalent, you don't want perl doing the killing of itself either, as that's not the right thing to do -- you want the interface module (mod_perl or whatever the IIS version is) do handle the timeouts and killing and whatnot. So there's nothing for perl to do there either. (The last thing you want is for something in the guts of the webserver to be dying. That's not good) mod_perl has timeout capabilities already. I have no idea if the IIS plugin for perl does.

    Looks like your technical problem is already solved or located somewhere else. If you still think it isn't, here certainly isn't the place to get it fixed -- you need to talk to the perl5-porters list if you're still convinced it's a perl problem, or whoever makes the perl plugin bits for IIS (I presume ActiveState).

      Apache will not kill the process if it's runaway and the user clicks stop or refresh. The timeout setting is missed. Please give it a try for yourself. Perl keeping control of itself IS the right thing to do. You can't expect every program that calls it to task care of problems in Perl scripts. Giving them a switch so that Perl takes care of itself with more than boost perls reputation to web hosts.
        Yes, yes it will. Set the RLimitCPU setting and try it. Apache's perfectly happy to kill runaway CGI child processes, as it should, since it's running the show. Doesn't matter of the user clicks a damn thing, the limit is applied regardless, as it ought to be. Servers are ultimately responsible for the maintenance of their children. Thirty seconds with google shows that IIS will also do this if you tell it, again as it should, since it's running the show.

        Putting the limit in perl won't solve this problem. If the admins aren't going to enable the limits in the server they're not going to do it for perl programs, so you get nothing. And, from bitter experience, it's pretty clear that leaving it to the client to enforce time limits doesn't work either. (Since making your code do this now takes all of two lines, and isn't entirely reliable in the face of a number of third party libraries anyway)

        You've got the wrong solution to your problem, and as such it won't solve the problem. Use the right solution, which you already have.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://404646]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2018-05-25 11:48 GMT
Find Nodes?
    Voting Booth?