unable to shut down green thread pool executor from within a periodics on_failure callback

Bug #1706588 reported by milan k on 2017-07-26
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
futurist
Undecided
Unassigned

Bug Description

I'm trying to terminate a service[1] upon a periodics unrecoverable error through the on_failure callback. However, I'm unable to shut_down() the green thread pool executor:

(venv) jahoda:futurist_test mkovacik$ python test.py
DEBUG:Periodics Test Service:starting service
INFO:Periodics Test Service:Service running... Press CTRL+C to terminate.
DEBUG:futurist.periodics:Submitting periodic callback '__main__.clean_up'
DEBUG:Periodics Test Service:Cleaning up
DEBUG:futurist.periodics:Submitting periodic callback '__main__.clean_up'
DEBUG:Periodics Test Service:Cleaning up
WARNING:Periodics Test Service:Bad luck!
ERROR:Periodics Test Service:Callable <function clean_up at 0x10ec2e488> periodic, 10) encountered exc (<class 'RuntimeError'>, RuntimeError('Oops!',), <traceback object at 0x10ec277c8>) (None)
DEBUG:Periodics Test Service:stopping service
DEBUG:Periodics Test Service:stopping worker
DEBUG:Periodics Test Service:shutting down executor
ERROR:futurist.periodics:On failure callback <bound method Service.clean_up_watchdog of <__main__.Service object at 0x10ec1d240>> raised an unhandled exception. Error: Calling waitall() from within one of the GreenPool's greenthreads will never terminate.
DEBUG:futurist.periodics:Stopped running 1 callbacks:
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
| Name | Runs | Failures | Successes | Stop Requested | Average elapsed | Average elapsed waiting |
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
| __main__.clean_up | 2 | 1 | 1 | False | 0.0002s | 0.0005s |
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
DEBUG:Periodics Test Service:stopping service
INFO:Periodics Test Service:Service sys.exit() time
(venv) jahoda:futurist_test mkovacik$

Esp. see the error log:

ERROR:futurist.periodics:On failure callback <bound method Service.clean_up_watchdog of <__main__.Service object at 0x10ec1d240>> raised an unhandled exception. Error: Calling waitall() from within one of the GreenPool's greenthreads will never terminate.

[1] http://paste.openstack.org/show/616565/

milan k (vetrisko) on 2017-07-26
description: updated
Ben Nemec (bnemec) wrote :

I'm no longer seeing this error when testing the example:

$ ./test.py
DEBUG:Periodics Test Service:starting service
INFO:Periodics Test Service:Service running... Press CTRL+C to terminate.
^CDEBUG:Periodics Test Service:stopping service
DEBUG:Periodics Test Service:stopping worker
DEBUG:Periodics Test Service:shutting down executor
DEBUG:futurist.periodics:Stopped running 1 callbacks:
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
| Name | Runs | Failures | Successes | Stop Requested | Average elapsed | Average elapsed waiting |
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
| __main__.clean_up | 0 | 0 | 0 | False | . | . |
+-------------------+------+----------+-----------+----------------+-----------------+-------------------------+
INFO:Periodics Test Service:Service sys.exit() time

I'm taking that to mean this is fixed. If you find otherwise feel free to reopen it though.

Changed in futurist:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers