EventStore / EventStore-Client-Dotnet

Dotnet Client SDK for the Event Store gRPC Client API written in C#
Other
147 stars 38 forks source link

AppendToStreamAsync hangs when eventData enumerable throws an exception #203

Open Aethon opened 2 years ago

Aethon commented 2 years ago

Describe the bug When calling AppendToStreamAsync, if the eventData enumerable throws an exception, the call does not return or throw until the gRPC client times the operation out. The exception from the timeout does not contain any detail from the enumerable exception.

To Reproduce Steps to reproduce the behavior: Run this code

public async Task HangExample()
{
    EventData MakeData(int index) => throw new Exception("bad data");

    var client = new EventStoreClient(
        EventStoreClientSettings.Create("esdb://localhost:2113?tls=false")
    );

    await client.AppendToStreamAsync(
        "somestream",
        StreamRevision.None,
        Enumerable.Range(1, 3).Select(MakeData)
    );
}

Expected behavior The original "bad data" exception or some exception with that exception as inner exception should be thrown immediately.

Actual behavior The call hangs until the gRPC call times out. The exception that is thrown simply indicates that the deadline expired with no additional detail.

EventStore details

NielsPilgaard commented 1 year ago

I cannot reproduce this using EventStore.Client.Grpc.Streams.22.0.0