Forums

My console reset earler today- not sure why.

In one of my consoles (Bash console 1660712) i had a multi-threaded script running and all of the threads stopped running around 12:46 today.

Logs suggest there were no exceptions that caused it to exit. Any ideas why this happened? Were you guys doing any upgrades or maintenance by any chance?

I am trying to identify the cause to prevent this from happening again.

in fact it looks like my other console (TEST) also reset. that had nothing running it it, but the output history and pwd has changed since the last time I accessed it.

Hi there,

The console servers are periodically restarted due to server maintenance and other reasons. (Imagine how you need systemd or upstart etc on a linux machine to continuously monitor and ensure that your script/service is running) Check out our wiki post on long running tasks to see a solution for doing this on PythonAnywhere.

Thanks for the pointer to that post.

So my script spawns 10 different threads and does not wait for it to them to return, they just go off doing their thing indefinitely.

Would the socket lock on the main thread approach still work? Or would the lock be released once the execution on my main thread is finished?

You will have to modify your code accordingly. For example, you could do a threads.join to wait for the threads to finish before exiting.