EventStore-Client-Dotnet icon indicating copy to clipboard operation
EventStore-Client-Dotnet copied to clipboard

RpcException When Using AppendToStreamAsync From Windows

Open robbytarigan opened this issue 1 year ago • 10 comments

Describe the bug RpcException When Using AppendToStreamAsync From Windows.

To Reproduce Steps to reproduce the behavior:

  1. Use Windows 11 OS
  2. Use latest package at the time of writing which is EventStore.Client.Streams version 23.2.1
  3. Run the quick start example from https://github.com/EventStore/EventStore-Client-Dotnet/blob/master/samples/quick-start/Program.cs

Expected behavior The stream is appended

Actual behavior RpcException was thrown with error below:

Grpc.Core.RpcException: Status(StatusCode="DeadlineExceeded", Detail="")
   at EventStore.Client.Interceptors.TypedExceptionInterceptor.<>c__DisplayClass1_0.<.ctor>b__0(RpcException rpcEx)
   at EventStore.Client.Interceptors.RpcExceptionConversionExtensions.<>c__DisplayClass1_0`1.<Apply>b__0(Task`1 t)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at EventStore.Client.GrpcServerCapabilitiesClient.GetAsync(CallInvoker callInvoker, CancellationToken cancellationToken)
   at EventStore.Client.EventStoreClientBase.GetChannelInfoExpensive(ReconnectionRequired reconnectionRequired, Action`1 onReconnectionRequired, IChannelSelector channelSelector, CancellationToken cancellationToken)
   at EventStore.Client.SharingProvider`2.FillBoxAsync(TaskCompletionSource`1 box, TInput input)
   at EventStore.Client.TaskExtensions.WithCancellation[T](Task`1 task, CancellationToken cancellationToken)
   at EventStore.Client.EventStoreClientBase.GetChannelInfo(CancellationToken cancellationToken)
   at EventStore.Client.EventStoreClient.<CreateStreamAppender>g__GetCall|17_0()
   at EventStore.Client.EventStoreClient.StreamAppender.Receive()
   at EventStore.Client.EventStoreClient.AppendToStreamAsync(String streamName, StreamState expectedState, IEnumerable`1 eventData, Action`1 configureOperationOptions, Nullable`1 deadline, UserCredentials userCredentials, CancellationToken cancellationToken)
   at Program.<Main>$(String[] args)

Config/Logs/Screenshots The event store server was run using docker with command below

docker run --rm --name esdb-node -it -p 2113:2113 -p 1113:1113 eventstore/eventstore:latest --insecure --run-projections=All --enable-atom-pub-over-http

EventStore details

  • EventStore server version: 24.2.0

  • Operating system: Windows 11

  • EventStore client version 23.2.1

Additional context Add any other context about the problem here.

robbytarigan avatar May 02 '24 09:05 robbytarigan

Does this happen constantly? I'm on Windows 11 too and unable to reproduce this error. Which target framework are you on?

w1am avatar May 03 '24 12:05 w1am

Also worth mentioning whether other operations work etc - i.e. is it simply a firewall-driven timeout due to how your environment is configured? ESDB is not a low usage system so it's not a matter of SELECT being broken. Are you sure you'e configuring the server to serve on the correct ports (for gRPC, which your code is using; not TCP, which is dead)?

bartelink avatar May 03 '24 13:05 bartelink

I'm not sure about what configuration available. I follow the docker run instruction which use arguments --insecure--run-projections=All --enable-atom-pub-over-http and the port is mapped the same into my local machine.

I've tried the read operation ReadStreamAsync which also failed with similar error

Grpc.Core.RpcException: Status(StatusCode="DeadlineExceeded", Detail="")

robbytarigan avatar May 03 '24 15:05 robbytarigan

Does this happen constantly? I'm on Windows 11 too and unable to reproduce this error. Which target framework are you on?

This happen constantly. I target .NET 8.0

The project content is below

<Project Sdk="Microsoft.NET.Sdk">

    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <TargetFramework>net8.0</TargetFramework>
        <ImplicitUsings>enable</ImplicitUsings>
        <Nullable>enable</Nullable>
    </PropertyGroup>

    <ItemGroup>
      <PackageReference Include="EventStore.Client.Grpc.Streams" Version="23.2.1" />
    </ItemGroup>

</Project>

robbytarigan avatar May 03 '24 15:05 robbytarigan

Hi @robbytarigan, I have tried this too and have been unable to recreate the problem.

Would it be possible for you to provide a small reproducible example via a public GitHub repository? Preferably using docker compose.

Thanks in advance!

josephcummings avatar May 03 '24 15:05 josephcummings

Hi @josephcummings

I don't think I can reproduce it using docker compose because it does not support mixed windows and linux containers. I even cannot keep the evenstore server running when I switched into windows container. Probably I will need a bit more complex setup to make it reproducible, so need to think different idea.

robbytarigan avatar May 03 '24 16:05 robbytarigan

@robbytarigan no problem, if it is just the sample you are running as-is then my request for a composable reproducible example likely won't prove useful - I misread the second bullet point in the repro steps and assumed you may have a custom application where you are experiencing the issue, too, my apologies.

Regarding Windows vs Linux containers, the eventstore:latest image is a linux image so your Docker would need to be configured to run linux containers on windows desktop for the docker run ... command you are using to work.

Please can you try running the same docker run command but in detached mode as per below, then monitor the health of the container and let me know if you can see the container reach healthy status?

docker run -d --rm --name esdb-node -it -p 2113:2113 -p 1113:1113 eventstore/eventstore:latest --insecure --run-projections=All --enable-atom-pub-over-http

Assuming everything is OK, you should see something like the below:

image

If possible, it would be handy to have a dump of the container/server logs? Healthy or not.

josephcummings avatar May 03 '24 17:05 josephcummings

The eventstore server is healthy. Please see the screenshot below image

Please also see the server logs attached. server.log

robbytarigan avatar May 05 '24 22:05 robbytarigan

@robbytarigan Does the event appear in the stream browser?

w1am avatar May 06 '24 05:05 w1am

@w1am No, the event does not appear

robbytarigan avatar May 06 '24 20:05 robbytarigan

@robbytarigan I suggest testing a simple operation using a different client, such as the Node.js client or with a different server version (lts). If you continue to encounter the same issue, the problem is likely with your environment.

Have you also considered increasing the timeout to see if it makes a difference?

var settings = EventStoreClientSettings.Create(connectionString); 
settings.ConnectivitySettings.KeepAliveTimeout = TimeSpan.FromMinutes(1); 

w1am avatar May 07 '24 04:05 w1am

@w1am I followed your suggestion to use NodeJS client example, and there is no problem with it. I put the screenshot for this operation here

image

I also try KeepAliveTimeout settings as suggested and it still gives the same error.

robbytarigan avatar May 08 '24 22:05 robbytarigan

@robbytarigan Can you try with this connection string in the dotnet client instead

esdb://admin:[email protected]:2113?tls=false&tlsVerifyCert=false

The difference is that I replaced localhost with 127.0.0.1

Remove the previous keepAliveTimeout option I proposed initially

w1am avatar May 09 '24 10:05 w1am

@w1am I cannot believe it works by replacing localhost with 127.0.0.1. I can see the stream is stored too now. I'll use 127.0.0.1 during local development then. Thank you!

robbytarigan avatar May 13 '24 19:05 robbytarigan