Skip to content
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

Kill ptop properly #26

Open
darxtrix opened this issue Jul 15, 2017 · 4 comments
Open

Kill ptop properly #26

darxtrix opened this issue Jul 15, 2017 · 4 comments

Comments

@darxtrix
Copy link
Owner

darxtrix commented Jul 15, 2017

Observation 1:

In case any exception occurs, an exception should be logged properly and ptop should be killed properly will all of the threads ( gui and sensor threads ) killed properly. For eg. in case, the GUI cannot be drawn properly exception occurs and ptop hangs.

Observation 2:

While killing ptop, catch the kill signals properly and kill all the threads.

@vinusankarsiitgn
Copy link

Just add the following code to quit()
my_pid = os.getpid()
target = psutil.Process(int(my_pid))
try:
target.terminate()
except:
self._logger.info("Operation failed", exc_info=True)

The issue was because quit only raised a keyboard interrupt, but not killed the process itself.

@darxtrix
Copy link
Owner Author

Thanks for the suggestions. I primarily made the issues for keeping a track of things and get some contributions going. A bit busy nowadays, will start on things when i will get some bandwidth.

@darxtrix
Copy link
Owner Author

@vinusankarsiitgn I checked the pr, let me be affirmative on that. Thanks !

@darxtrix
Copy link
Owner Author

The real problem is that the exceptions in child thread are not getting caught in the main thread of the application. We need to either set the global threading.Event at all the places where exceptions can occur in threads or we need to use some kind of message passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants