Page 1 of 1

If a GCI loop executes in the woods and no body hears it...

Posted: Mon Dec 06, 2010 8:49 pm
by Isaac
So you know how letting Isaac experiment on your server can be bad? ...

If I executed a python script and accidentally left a loop that would keep adding to a variable, one number at a time, would it die if I closed the browser? Or is there a chance it's still going... If so, did hitting refresh a bunch of times execute a bunch of other instances of the same program?

Posted: Mon Dec 06, 2010 8:53 pm
by Isaac
Can I
import os
os.system(\"killall python\")
?

Posted: Mon Dec 06, 2010 8:56 pm
by Isaac
Also, I executed these yesterday and the server is still running... I guess that means there's no problem, right?

Posted: Mon Dec 06, 2010 11:40 pm
by Jeff250
If you close your browser? Are you talking about Web programming server-side with Python? How are you interfacing python with your server? With mod_python? Cgi? Fastcgi? Wsgi?

Posted: Tue Dec 07, 2010 3:15 am
by Sirius
If in doubt, power-cycle the machine.

Re:

Posted: Tue Dec 07, 2010 6:24 am
by Isaac
Sirius wrote:If in doubt, power-cycle the machine.
Jeff250 wrote:If you close your browser? Are you talking about Web programming server-side with Python? How are you interfacing python with your server? With mod_python? Cgi? Fastcgi? Wsgi?
It's a script in /Public_HTML/CGI-BIN/test.cgi
Then it gets pointed to by index.html
I've already fixed test.cgi, but since I don't have access to the SSH account, through the terminal, I have no way of running any commands, unless I import os directly in the script... of course I'm not sure what effects killing python would have.

My account is jailed, however.

Posted: Tue Dec 07, 2010 6:30 am
by Isaac
I have learned from this, that I should always test scripts on my laptop before sending them to the server.

Posted: Tue Dec 07, 2010 7:45 am
by Avder
I'm sure if some process of yours is causing problems, the server op would notice it and swiftly kill said process.

Posted: Tue Dec 07, 2010 1:51 pm
by Jeff250
With CGI, apache is generally configured with some timeout, where if you don't output anything in X seconds, your script is killed. So if you *aren't* outputting anything in your loop, and your server is sanely configured, your script will eventually die. On the other hand, if you *are* outputting something in a loop, Apache will kill your script when it tries to send your output after the connection has been closed (like when you closed your browser). This may not be immediate, since Apache generally buffers output before sending it.

Posted: Tue Dec 07, 2010 2:21 pm
by Isaac
Oh ok! So my print command would have caused an error when no browser was available to print to. Hmm. I know there's an error log related to this, somewhere...