Open kerams opened 3 years ago
I observe the same behavior, albeit with the eventstore/eventstore:21.10.1-buster-slim image.
Hi @kerams and @james-allan-lloyd thanks for the detailed report, I can reproduce this on EventStoreDB 22.6.0, and the master branch for the gRPC client.
However, I'm only seeing this issue when running EventStoreDB in insecure mode in docker. I don't see it when running EventStoreDB locally, or when I run EventStoreDB in a secure docker container.
Can you confirm this as well?
In the logs, I always see a deadline exceeded
error before the client takes a long time to resubscribe, which leads me to believe that there's a timeout that's not handled correctly internally in the client.
It was indeed insecure in a container. Unfortunately, I do not have the opportunity to try other scenarios right now.
I was analyzing this issue too. I did some profiling and I think the problem seems to be in this method, according to the profiler: https://github.com/EventStore/EventStore-Client-Dotnet/blob/8ec180533c1f1c5e868744e9f006b20f135bc450/src/EventStore.Client/SharingProvider.cs#L85
Describe the bug The docs don't describe resubscribing after dropped subscriptions in detail, so I came up with my own solution (for simplicity's sake I'm glossing over checkpoints here):
This works very well when I start the application and restart Event Store--resubscriptions and replays are almost instant. The problem appears when I start the application while Event Store is offline. When I bring it online, the call to
SubscribeToStreamAsync
hangs for around 2 minutes, maxing out a CPU core and, according to VS, allocating 1.5GB over that period (it must get collected quickly because memory used remains stable), but it does succeed in the end. Resubscribing after subsequent Event Store restarts is immediate again.To Reproduce Steps to reproduce the behavior:
newstream
Expected behavior
SubscribeToStreamAsync
yields quickly when the application is started with Event Store offline and then launched.Actual behavior
SubscribeToStreamAsync
takes a couple of minutes and consumes resources when the application is started with Event Store offline and then launched.EventStore details