dapr / dapr/go-sdk

Subscribe does not recreate the grpc connection

Open
#690 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
479
Forks
187
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

This may not be considered a bug but a feature request... anyway, the streaming subscription functions don't recreate the grpc connection after unexpected client disconnections, resulting in the subscription to stop working while the user application has no way of detecting it or be notified.

The go sdk currently only prints this log
```
Error receiving messages from subscription pubsub=pubsub topic=footopic, closing subscription: rpc error: code = Unknown desc = error handling streaming subscription: api server closed
```

**To Reproduce**

- Run a sample application using `SubscribeWithHandler` or `Subscribe`
- verify the subscription receives messages
- shut down the dapr sidecar (easily doable if running dapr locally and running the app and the sidecar separately)
- notice the log message on the application and that it no longer can receive pubsub messages

**Expected behavior**

Similar to the grpc stream used in the Workflows API, I would expect the grpc connection for streaming subscriptions to be resilient and to be infinitely recreated until the user stops the subscription

Contributor guide

Open the contributing guide

Research direction

Start by tracing the SubscribeWithHandler and Subscribe entry points and compare their streaming behavior with the resilient gRPC stream used in the Workflows API. Reproduce the issue by shutting down the Dapr sidecar, then verify that the subscription resumes receiving messages after the connection is recreated and continues until the user stops it.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, grpc
Domain
backend-api-design, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.