Hi,
We are trying to migrate one of our production services from MSSQL to ESDB. by running an import using AppendToStreamAsync. However it stops working every 100 events or so by throwing a DeadlineExceeded exception. This is what we’re seeing in the client log:
[16:00:18 INF] Processing PageAddedEventV1(4d2e3b7c-5d99-4ced-af84-44dfa4dc27f7) [03511016]...
[16:00:18 DBG] Starting gRPC call. Method type: 'ServerStreaming', URI: 'https://esdb3.joure1.net:2113/event_store.client.streams.Streams/Read'.
[16:00:18 DBG] Sending message.
[16:00:18 VRB] Serialized 'EventStore.Client.Streams.ReadReq' to 80 byte message.
[16:00:18 VRB] Message sent.
[16:00:18 VRB] Response headers received.
[16:00:18 DBG] Reading message.
[16:00:18 VRB] Deserializing 56 byte message to 'EventStore.Client.Streams.ReadResp'.
[16:00:18 VRB] Received message.
[16:00:18 DBG] Reading message.
[16:00:18 INF] Appending PageAddedEventV1(4d2e3b7c-5d99-4ced-af84-44dfa4dc27f7) to stream pageaggregate-b11dc7e0-bf6d-5bf1-8c03-f218e803ea8a...
[16:00:18 VRB] No message returned.
[16:00:18 DBG] Append to stream - pageaggregate-b11dc7e0-bf6d-5bf1-8c03-f218e803ea8a@Any.
[16:00:18 DBG] Finished gRPC call.
[16:00:18 DBG] Sending message.
[16:00:18 VRB] Serialized 'EventStore.Client.Streams.BatchAppendReq' to 2148 byte message.
[16:00:18 VRB] Message sent.
[16:00:21 VRB] Deserializing 143 byte message to 'EventStore.Client.Streams.BatchAppendResp'.
[16:00:21 VRB] Received message.
[16:00:21 DBG] Reading message.
[16:00:51 ERR] Processing failed
System.AggregateException: One or more errors occurred. (Status(StatusCode="DeadlineExceeded", Detail="Timeout"))
---> Grpc.Core.RpcException: Status(StatusCode="DeadlineExceeded", Detail="Timeout")
at EventStore.Client.Streams.BatchAppendResp.ToWriteResult()
at EventStore.Client.EventStoreClient.StreamAppender.Receive()
at EventStore.Client.EventStoreClient.StreamAppender.AppendInternal(Options options, IEnumerable`1 events, CancellationToken cancellationToken)
at EventStore.Client.EventStoreClient.AppendToStreamAsync(String streamName, StreamState expectedState, IEnumerable`1 eventData, Action`1 configureOperationOptions, Nullable`1 deadline, UserCredentials userCredentials, CancellationToken cancellationToken)
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.Wait()
at Program.<Main>$(String[] args) in ...\Program.cs:line 175
We’ve been checking the flow for every imported events, but there are no significant differences. It just stops after reading the BatchAppendResp
.
Our code has been tested already in a staging environment. Here we were able to import over 900K events without any exceptions.
Program.cs
try
{
var events = client.ReadStreamAsync(Direction.Forwards, streamName, StreamPosition.Start);
if (events.AnyAsync(a => a.OriginalEvent.EventId == eventId).Result)
{
logger.LogWarning($"Skipping {messageName}({messageId}) [{sequenceId:00000000}] as it already has been appended...");
continue;
}
}
catch
{
//***** Do nothing;
}
//*****
var eventData = new EventData[] { new(eventId, messageName, data, headers, mediaType) };
logger.LogInformation($"Appending {messageName}({messageId}) to stream {streamName}...");
client.AppendToStreamAsync(streamName, StreamState.Any, eventData).Wait();
logger.LogInformation($"{messageName}({messageId}) appended to stream {streamName}");
We are running ESDB 21.10.1.0 with client version 22.0.0.
Any thoughts?
Cheers,
Peter