Github user ahgittin commented on the issue:
https://github.com/apache/brooklyn-server/pull/816
have gotten to the bottom of the race. seems it has been around for a
while, not introduced here, but now flagged as we now don't run our listeners
on cancel.
if a task is cancelled after submission and before the executor runs it,
the executor doesn't run it, consistent with `Future.cancel`. However in our
code we want to run the before-start/after-end hooks even on cancellation
(though we don't run the submitted job) so we relied on the executor running.
Will fix this by saying if a task is cancelled after submit and before
start, we run a special `afterEndForCancelBeforeStart`.
---