cancel_pending_task should always be called from the reactor