-
Notifications
You must be signed in to change notification settings - Fork 107
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
Set the monitor_running event to unblock the main thread #633
Set the monitor_running event to unblock the main thread #633
Conversation
This fixes the issues I saw in ManageIQ/manageiq#20290 where we'd do @agrare tracked this down to where we trap interrupts and later react to them once do_work completes. Since |
@agrare Don't suppose there's a way to spec this, is there? |
@djberg96 the existing tests for Worker Runners are pretty hacky and have to stub a bunch of stuff to not actually start up a worker, so there isn't an easy way to spec this |
Without setting the monitor_running concurrent event the main event_catcher worker thread doesn't ever leave the do_before_work_loop which means it can't be shutdown cleanly until the first event is raised.
475b1d1
to
d8308e7
Compare
For reference this is what the VMware event catcher does: https://github.com/ManageIQ/manageiq-providers-vmware/blob/master/app/models/manageiq/providers/vmware/infra_manager/event_catcher/runner.rb#L27-L29 |
Checked commit agrare@d8308e7 with ruby 2.5.7, rubocop 0.69.0, haml-lint 0.28.0, and yamllint |
Hm that's a good question, my first reaction was no because once an event is caught and yielded to that block it would set the event that the monitor thread was started. There could be some weirdness though in the fact that the main runner thread isn't in the do_work loop where it actually processes events until that event is set. |
…running Set the monitor_running event to unblock the main thread (cherry picked from commit 3d9f090)
Jansa backport details:
|
The do_before_work_loop starts the event monitor.
This spins up the thread and waits for it to be started. The amazon event catcher only sets the started event to true once an event is raised.
This means if you try to stop the event catcher before an event occurs you have to SIGKILL it as it will never shutdown cleanly.