Fix SubscribeAsync silently failing when Dapr sidecar is unavailable#1744
Open
GeorgeTsiokos wants to merge 1 commit intodapr:masterfrom
Open
Fix SubscribeAsync silently failing when Dapr sidecar is unavailable#1744GeorgeTsiokos wants to merge 1 commit intodapr:masterfrom
GeorgeTsiokos wants to merge 1 commit intodapr:masterfrom
Conversation
…apr#1663) - Throw DaprException wrapping RpcException on initial connection failure - Add SubscriptionErrorHandler callback for runtime errors in background tasks - Reset hasInitialized on any failure (initial or mid-stream) to allow retry - Guard ErrorHandler invocation with try/catch to prevent unobserved exceptions - Use CancellationToken.None for ContinueWith to ensure error handlers fire - Include topic/pubsub names in error messages for multi-subscription debugging Resolves dapr#1663 Signed-off-by: George Tsiokos <george@tsiokos.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
74b1b32 to
9ce96c6
Compare
Contributor
|
Do note that I just merged a PR to support xUnit v3 so your unit/integration tests may need a refresh. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1663
SubscribeAsyncnow catchesRpcExceptionfrom the gRPC stream setup and throws aDaprExceptionwith context (topic name, pubsub name), allowing callers to detect and handle sidecar unavailabilitySubscriptionErrorHandlerdelegate andErrorHandlerproperty onDaprSubscriptionOptionsso callers can receiveDaprException-wrapped errors from background tasks instead of having them becomeUnobservedTaskExceptionshasInitializedflag on both initial connection failures and mid-stream background task failures, so callers can retrySubscribeAsyncErrorHandler?.Invoke()with try/catch to prevent a faulty handler from recreating unobserved exceptionsTest plan
HandleTaskCompletioninvokesErrorHandlerwithDaprExceptionwrapping the original exceptionHandleTaskCompletiondoes not throw when noErrorHandleris setHandleTaskCompletiondoes not throw whenErrorHandleritself throwsHandleTaskCompletiondoes not invokeErrorHandlerfor successful tasksSubscribeAsyncthrowsDaprExceptionwrappingRpcExceptionwhen sidecar unavailableSubscribeAsyncallows retry afterRpcExceptionfailure (hasInitializedreset)SubscribeAsyncresetshasInitializedfor non-RPC exceptions (e.g.ObjectDisposedException)🤖 Generated with Claude Code