-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated .kill method in CodeEngine to broadcast exit message
and kill its Code objects concurrently. There is a concurrency problem with the .kill call and each of CodeEngine's reportStatus interval, which uses the pubsub. The issue happens when the following happens: - reportStatus interval timer is cleared (by the .kill call) - pubsub is closed (by the .kill call) - the pending callback for reportStatus (that was already in the event queue) fires, but since pubsub is closed it throws. While we can safely ignore this error (in this case), we should still throw because there would be other cases where we want to be notified about the failure of a publish call. Putting an extra check in the publish call (to see if pubsub is open) would be too expensive, as the check would happen for every invocation of .publish(). It's probably better to just throw and handle the exception. If we were to eliminate this concurrency issue, we need to redesign the Pubsub API - the current implementation does not take into account multiple objects adding event handlers (subscriptions) to the Pubsub object; it assumes there is always a single object accessing the Pubsub. This is the reason CodeEngine and Code objects also have to do bookkeeping and track their own subscription handlers (and unsubscribe accordingly when it is going down)
- Loading branch information
1 parent
ac81683
commit ee5c4a1
Showing
3 changed files
with
19 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters