Forums

Unable to kill the process

Hi,

It seems that, although I killed all the processes, our Python program is still running. The program periodically accesses our HTTP server and our server has kept receiving requests from the IP address of PythonAnywhere.

Also I tried to execute "ps" on the console, but failed because there is no "ps" command. Would you please investigate this?

Thanks.

Hi ousia -- I can see some processes still running in a live ssh session, and also some that appear to have been started from PythonAnywhere via a console. Which ones would you like me to kill?

Also -- I'm surprised that the ones that were started from the console are still there when it looks like you don't have any consoles running. How did you start them?

Re: ps -- we don't provide it right now because your processes can be running on any of a number of different machines. We're looking into ways of providing pan-cluster ps and kill commands, but it might take a while.

Hi ousia -- I can see some processes still running in a live ssh session, and also some that appear to have been started from PythonAnywhere via a console. Which ones would you like me to kill?

I don't use any processes right now, so would you please kill all of them?

Also -- I'm surprised that the ones that were started from the console are still there when it looks like you don't have any consoles running. How did you start them?

I think I did not do anything special. I just run the program by pressing "Save & Run" and so on. So, I would also like to know why the processes are still remaining. :)

OK, so I've killed all of your processes.

So, just to be sure -- you didn't start any via an ssh session? If so, that's really weird, because some of them looked like they were started that way.

As to why they weren't killed when you killed the associated console -- perhaps there's something in your code (or something it depends on) that's making them ignore the kill signals we send? If you want, I can take a look at the code and see if there's anything that stands out.

I know that proper process support is probably a big job, but I wonder if there's mileage in at least a big red "kill all my processes" button, which sends first SIGINT and then, after a delay, SIGKILL to all of a user processes on all hosts except those relating to a web app.

I think once we've moved to a better virtualisation technology we'll just mount /proc for users and then they can have total control.

Mmmmm...did I hear total control?

That's the plan...

As to why they weren't killed when you killed the associated console -- perhaps there's something in your code (or something it depends on) that's making them ignore the kill signals we send? If you want, I can take a look at the code and see if there's anything that stands out.

It would be appreciated that you check the code directly. I think it might be caused because our code contains try-except block without specifying the exception type. Does your system send SIGINT to kill the process? It seems that Python only raises an exception which might be wrongly handled by our code.

Also, looking forward to the total control :)

Additionally, it appears that some processes, which are not shown in the console, are still running. Could you please kill them manually? We are not currently running any critical processes, so simply killing all processes would be OK.

Thanks.

A try/except block should be fine. I actually suspect this might be related to a bug with Save and Run occasionally not attaching the process to the console properly. You could try using a Bash console and doing

python /home/ousia/your_script_name.py

Hi Hansel,

Thank you for your reply. Okay, I will use Bash instead of Save & Run button. Also, if you figure out the reason, please let us know.

BTW, did you kill our old processes?

Thanks.

Hi ousia,

I did indeed kill your old processes. I'm pretty sure we've diagnosed the cause (a race condition! Of course...) but we just need to schedule some time to fix it.

I've a weird problem. The scheduler is showing a ton of scheduled jobs running, when there shouldn't be any running at this time. The 'command' field is empty for all of them. Could you check?

Hi there -- I think this is related to something we emailed you about yesterday. Will follow up on that email thread.

Hi! Looks like I have the same problem as topic starter. Can you kill my processes ?

Sure, that's done. It looks like your website had left a bunch of processes running.

Hi! Thanks a lot! But can you do it again? At last time:)

Ok. That's done

how to kill the running server , terminal is closed still its running

how to kill the running server , terminal is closed still its running

If you go to the "Consoles" page and click the "Fetch process list" button at the bottom, it will display a list of all processes that you have running. There's a kill button next to each of them.

thanks for the reply ! I didn't Know about web tab functionality , please clear to all the newbies that no need to manage server from console same thing can be done from web tab !!!

How do you recommend executing/killing processes to ensure that this doesn't happen in the future? Is using the bash console instead of "save and run" enough?

i think the easiest would be to kill from the consoles tab -> fetch process list. there should not be a difference between running from a bash console vs save and run. for both, you could make sure the console is closed/exited to stop the process

I just killed the web server from the consoles tab -> fetch process list. But the website is still up and functioning normally 5 min later. What did I do wrong?

BTW, very impressed with your responsiveness to users questions!

The web server is not supposed to appear on the process list.

Then how do you stop/kill the web server?

oops, sorry, I thought you meant processes from the consoles tab. For the webserver the only will to restart it is to hit the reload button on the webapp tab.

My question is not how to restart the web app, but how to STOP it. So that people can't access the web app while I make changes.

You can’t exactly do that, but instead you could either enable password protection on the site, or delete it (it doesn’t delete your code) then recreate the web app when you are finished modifying the code

You could also do this in a different way. When I make changes to my site, I do it on a different PA account. When I’m ready to make the changes public, I push to GitHub from the second PA account, pull it from the main account, install the package, and reload the web app

Both of the options that @dull suggests will work. You can also wait a little bit, because we're currently working on providing that feature for web apps.