Skip to content

Fix Messenger::stop() to reject pending promises#67

Merged
matt2005 merged 1 commit intomainfrom
develop
Nov 13, 2025
Merged

Fix Messenger::stop() to reject pending promises#67
matt2005 merged 1 commit intomainfrom
develop

Conversation

@matt2005
Copy link
Copy Markdown

Fix Messenger::stop() to reject pending promises and prevent post-shutdown callbacks

Problem:
When AndroidAutoEntity::stop() called messenger_->stop(), only the message queue was cleared but pending receive/send promises remained active. This caused a flood of channel error callbacks (AASDK Error: 30) when the transport closed, leading to re-entrant teardown attempts and potential application freezes.

Solution:

  • Messenger::stop() now rejects all pending receive promises with OPERATION_ABORTED
  • Messenger::stop() now rejects all pending send promises with OPERATION_ABORTED
  • Both operations are dispatched on their respective strands to ensure thread safety

Impact:

  • Services will now receive OPERATION_ABORTED errors during shutdown (expected)
  • Prevents spurious channel errors after messenger is stopped
  • Enables clean, deterministic shutdown without callback floods
  • Applications should handle OPERATION_ABORTED as a normal shutdown signal

This is the library-level fix for clean async operation cancellation during teardown. Application-level services should treat OPERATION_ABORTED as debug-level logging.

…tdown callbacks

Problem:
When AndroidAutoEntity::stop() called messenger_->stop(), only the message queue
was cleared but pending receive/send promises remained active. This caused a flood
of channel error callbacks (AASDK Error: 30) when the transport closed, leading to
re-entrant teardown attempts and potential application freezes.

Solution:
- Messenger::stop() now rejects all pending receive promises with OPERATION_ABORTED
- Messenger::stop() now rejects all pending send promises with OPERATION_ABORTED
- Both operations are dispatched on their respective strands to ensure thread safety

Impact:
- Services will now receive OPERATION_ABORTED errors during shutdown (expected)
- Prevents spurious channel errors after messenger is stopped
- Enables clean, deterministic shutdown without callback floods
- Applications should handle OPERATION_ABORTED as a normal shutdown signal

This is the library-level fix for clean async operation cancellation during teardown.
Application-level services should treat OPERATION_ABORTED as debug-level logging.
@matt2005 matt2005 merged commit a7abe9c into main Nov 13, 2025
6 checks passed
@matt2005 matt2005 deleted the develop branch November 13, 2025 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant