Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connection disposed exception with TCP event reader #60

Open
shaan1337 opened this issue Jan 19, 2023 · 0 comments
Open

Connection disposed exception with TCP event reader #60

shaan1337 opened this issue Jan 19, 2023 · 0 comments
Labels

Comments

@shaan1337
Copy link
Member

shaan1337 commented Jan 19, 2023

Describe the bug
A customer reported seeing the following stack trace:

{"@t":"2022-12-23T03:13:15.6525085Z","@m":"Starting from a previously known checkpoint \"Position { EventNumber = 61876, EventPosition = 1077218785 }\"","@i":"7734e6c4","LastKnown":"Position { EventNumber = 61876, EventPosition = 1077218785 }","SourceContext":"EventStore.Replicator.FileCheckpointStore"}
{"@t":"2022-12-23T03:13:15.6525645Z","@m":"Reading from \"Position { EventNumber = 61876, EventPosition = 1077218785 }\"","@i":"91138b7a","Position":"Position { EventNumber = 61876, EventPosition = 1077218785 }","SourceContext":"EventStore.Replicator.Read.ReaderPipe"}
{"@t":"2022-12-23T03:13:15.6527311Z","@m":"Reader error","@i":"450d20cc","@l":"Error","@x":"System.ObjectDisposedException: Cannot access a disposed object.\nObject name: 'ES-2e381aa6-ae42-4b1d-aa8f-7f87e283d16a'.\n at EventStore.Replicator.Esdb.Tcp.TcpEventReader.ReadEvents(Position fromPosition, Func`2 next, CancellationToken cancellationToken) in /app/src/EventStore.Replicator.Esdb.Tcp/TcpEventReader.cs:line 54\n at EventStore.Replicator.Read.ReaderPipe.<>c__DisplayClass1_0.<<-ctor>g__Reader|1>d.MoveNext() in /app/src/EventStore.Replicator/Read/ReaderPipe.cs:line 60","SourceContext":"EventStore.Replicator.Read.ReaderPipe"}
{"@t":"2022-12-23T03:13:15.6528929Z","@m":"Reader stopped","@i":"49a9146f","SourceContext":"EventStore.Replicator.Read.ReaderPipe"}
{"@t":"2022-12-23T03:13:15.6529162Z","@m":"Storing the last known checkpoint","@i":"228021e9","SourceContext":"EventStore.Replicator.Replicator"}
{"@t":"2022-12-23T03:13:15.6531668Z","@m":"Will restart in 5 sec","@i":"d2d2cf9b","SourceContext":"EventStore.Replicator.Replicator"}

The crash seems to be coming from this line:

await _connection.ConnectAsync().ConfigureAwait(false);

It appears that _connection object's state was ConnectionState.Closed when calling ConnectAsync() (not sure why, maybe it was in the middle of a reconnection but this hypothesis doesn't seem to make sense since based on a quick glance at the code it appears that it's the first time we're calling ConnectAsync to establish the connection):
https://github.com/EventStore/EventStoreDB-Client-Dotnet-Legacy/blob/f29fb7f0c89bd1a7b7390379373b7266261da934/src/EventStore.ClientAPI/Internal/EventStoreConnectionLogicHandler.cs#L112

DEV-74

@alexeyzimarev alexeyzimarev changed the title Connection disposed exception with TCP event reader [DEV-4] Connection disposed exception with TCP event reader Mar 20, 2023
@alexeyzimarev alexeyzimarev changed the title [DEV-4] Connection disposed exception with TCP event reader Connection disposed exception with TCP event reader Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants