-
-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When aw-qt crashes, aw-server does not shut down #31
Comments
Isn't it possible to create a thread before running app.run() that acts as
a watchdog and runs os.exit() or something if orphaned?
…On Jul 20, 2017 10:28 PM, "Nikana" ***@***.***> wrote:
Same issue as ActivityWatch/aw-qt#19
<ActivityWatch/aw-qt#19>, only this process is
a Flask server, and run is inherited from Flask, so I can't put a if
os.getppid() == 1 inside it.
Flask <http://flask.pocoo.org/snippets/67/> has ways to shut itself down,
but typically by setting up a /shutdown page that sends the shutdown call
when requested, here we don't want to rely on requests, more like setup a
watchdog. Here
<https://stackoverflow.com/questions/15562446/how-to-stop-flask-application-without-using-ctrl-c>
gives similar options. There
<pallets/flask#1807> my questions is asked, and
most of the answer is "app.run() is only meant for development", not too
helpful.
Now, does the server really have to be restarted ? Should aw-qt test
whether the server is already up, and maybe connect to it rather than start
it, if it's already alive ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#31>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABVxuln5T0ppi2AATjVNb3vD52GbBDBiks5sP6phgaJpZM4OekJO>
.
|
@ErikBjare The top answer on the first SO link did it by creating a second process, and a lower rated solution on SO did it with threads like you mentioned. Should work fine, and takes up less resources than starting a whole new process. |
I think this was solved? If not aw-qt doesn't crash anymore so haven't really seen any instances of this. Closing in the meantime since I'm trying to move all actual issues into the main repo. If this remains a problem, open a new issue there and reference this one. |
Same issue as ActivityWatch/aw-qt#19, only this process is a Flask server, and
run
is inherited from Flask, so I can't put aif os.getppid() == 1
inside it.Flask has ways to shut itself down, but typically by setting up a
/shutdown
page that sends the shutdown call when requested, here we don't want to rely on requests, more like setup a watchdog. Here gives similar options. There my questions is asked, and most of the answer is "app.run() is only meant for development", not too helpful.Now, does the server really have to be restarted ? Should aw-qt test whether the server is already up, and maybe connect to it rather than start it, if it's already alive ?
The text was updated successfully, but these errors were encountered: