rabbitmq / rabbitmq-stream-dotnet-client

RabbitMQ client for the stream protocol
https://rabbitmq.github.io/rabbitmq-stream-dotnet-client/stable/htmlsingle/index.html
Other
122 stars 41 forks source link

Connection refused when running streams sample #374

Closed CoenraadS closed 6 months ago

CoenraadS commented 6 months ago

Describe the bug

Given the docker compose:

version: '3.8'

services:
  rabbitmq:
    image: rabbitmq:3-alpine
    ports:
      - "5672:5672"  # AMQP
      - "15672:15672"  # RabbitMQ Management UI
      - "5552:5552"  # Streams
    volumes:
      - ./rabbitmq-plugins.txt:/etc/rabbitmq/enabled_plugins 
    environment:
      RABBITMQ_SERVER_ADDITIONAL_ERL_ARGS: '-rabbitmq_stream advertised_host localhost'

rabbitmq-plugins.txt [rabbitmq_management,rabbitmq_management_agent,rabbitmq_stream].

When running the official sample at:

https://github.com/rabbitmq/rabbitmq-stream-dotnet-client/tree/main/docs/Documentation

The following error is thrown:

fail: RabbitMQ.Stream.Client.Reliable.Producer[0]
      Producer stream: my-stream, identifier: , client name: dotnet-stream-producer Error during the first boot No connection could be made because the target machine actively refused it.
fail: RabbitMQ.Stream.Client.StreamSystem[0]
      Unhandled exception
      System.AggregateException: One or more errors occurred. (No connection could be made because the target machine actively refused it.)
       ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
         at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
      --- End of stack trace from previous location ---
         at RabbitMQ.Stream.Client.Connection.Create(EndPoint endpoint, Func`2 commandCallback, Func`2 closedCallBack, SslOption sslOption, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Connection.cs:line 82
         at RabbitMQ.Stream.Client.Client.Create(ClientParameters parameters, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Client.cs:line 211
         at RabbitMQ.Stream.Client.Routing.CreateClient(ClientParameters clientParameters, Broker metaInfoBroker, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabUnhandled exception.bitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 27
         at RabbitMQ.Stream.Client.RoutingHelper`1.LookupConnection(ClientParameters clientParameters, Broker broker, Int32 maxAttempts, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 70
         at RabbitMQ.Stream.Client.RoutingHelper`1.<>c__DisplayClass4_0.<<LookupLeaderConnection>b__0>d.MoveNext() in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 185
      --- End of stack trace from previous location ---
         at RabbitMQ.Stream.Client.ConnectionsPool.GetOrCreateClient(String brokerInfo, Func`1 createClient) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\ConnectionsPool.cs:line 192
         at RabbitMQ.Stream.Client.RoutingHelper`1.LookupLeaderConnection(ClientParameters clientParameters, StreamInfo metaDataInfo, ConnectionsPool pool, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-s tream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 183
         at RabbitMQ.Stream.Client.RawProducer.Create(ClientParameters clientParameters, RawProducerConfig config, StreamInfo metaStreamInfo, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RawProducer.cs:line 77
         at RabbitMQ.Stream.Client.StreamSystem.CreateRawProducer(RawProducerConfig rawProducerConfig, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\StreamSystem.cs:line 320
         at RabbitMQ.Stream.Client.Reliable.ProducerFactory.StandardProducer() in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ProducerFactory.cs:line 96
         at RabbitMQ.Stream.Client.Reliable.ProducerFactory.CreateProducer(Boolean boot) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ProducerFactory.cs:line 29
         at RabbitMQ.Stream.Client.Reliable.Producer.CreateNewEntity(Boolean boot) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\Producer.cs:line 169
         at RabbitMQ.Stream.Client.Reliable.ReliableBase.MaybeInit(Boolean boot) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ReliableBase.cs:line 175
         at RabbitMQ.Stream.Client.Reliable.ReliableBase.Init(Boolean boot) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ReliableBase.cs:line 223
         at RabbitMQ.Stream.Client.Reliable.ReliableBase.Init(ReliableConfig reliableConfig) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ReliableBase.cs:line 167
         at RabbitMQ.Stream.Client.Reliable.Producer.Create(ProducerConfig producerConfig, ILogger`1 logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\Producer.cs:line 162
         at Documentation.GettingStarted.Start() in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\docs\Documentation\GettingStarted.cs:line 65
         --- 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 Documentation.StreamExample.Main(String[] args) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\docs\Documentation\StreamDoc.cs:line 8
fail: RabbitMQ.Stream.Client.Reliable.Producer[0]
      Unhandled exception
      System.AggregateException: One or more errors occurred. (No connection could be made because the target machine actively refused it.)
       ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
         at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
         at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
      --- End of stack trace from previous location ---
         at RabbitMQ.Stream.Client.Connection.Create(EndPoint endpoint, Func`2 commandCallback, Func`2 closedCallBack, SslOption sslOption, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Connection.cs:line 82
         at RabbitMQ.Stream.Client.Client.Create(ClientParameters parameters, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Client.cs:line 211
         at RabbitMQ.Stream.Client.Routing.CreateClient(ClientParameters clientParameters, Broker metaInfoBroker, ILogger logger) in C:\Users\coenraad.stijne\DownloadSystem.AggregateException: One or more errors occurred. (No connection could be made because the target machine actively refused it.)
 ---> System.Net.Sockets.SocketException (10061): No connection could be made because the target machine actively refused it.
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
   at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at System.Threading.Tasks.ValueTask.ValueTaskSourceAsTask.<>c.<.cctor>b__4_0(Object state)
--- End of stack trace from previous location ---
   at RabbitMQ.Stream.Client.Connection.Create(EndPoint endpoint, Func`2 commandCallback, Func`2 closedCallBack, SslOption sslOption, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Connection.cs:line 82
   at RabbitMQ.Stream.Client.Reliable.ReliableBase.Init(ReliableConfig reliableConfig) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\ReliableBase.cs:line 167
   at RabbitMQ.Stream.Client.Reliable.Producer.Create(ProducerConfig producerConfig, ILogger`1 logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\Reliable\Producer.cs:line 162
   at Documentation.GettingStarted.Start() in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\docs\Documentation\GettingStarted.cs:line 65
   --- 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 Documentation.StreamExample.Main(String[] args) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\docs\Documentation\StreamDoc.cs:line 8
s\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 27
         at RabbitMQ.Stream.Client.RoutingHelper`1.LookupConnection(ClientParameters clientParameters, Broker broker, Int32 maxAttempts, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 70
         at RabbitMQ.Stream.Client.RoutingHelper`1.<>c__DisplayClass4_0.<<LookupLeaderConnection>b__0>d.MoveNext() in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 185
      --- End of stack trace from previous location ---
         at RabbitMQ.Stream.Client.ConnectionsPool.GetOrCreateClient(String brokerInfo, Func`1 createClient) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\ConnectionsPool.cs:line 192
         at RabbitMQ.Stream.Client.RoutingHelper`1.LookupLeaderConnection(ClientParameters clientParameters, StreamInfo metaDataInfo, ConnectionsPool pool, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RoutingClient.cs:line 183
         at RabbitMQ.Stream.Client.RawProducer.Create(ClientParameters clientParameters, RawProducerConfig config, StreamInfo metaStreamInfo, ILogger logger) in C:\Users\coenraad.stijne\Downloads\rabbitmq-stream-dotnet-client-main\rabbitmq-stream-dotnet-client-main\RabbitMQ.Stream.Client\RawProducer.cs:line 77
         at RabbitMQ.Stream.Client.StreamSystem.CreateRawProducer(RawProducerConfig rawProducerConfig, ILogger logger)

It did however manage to make the queue:

image

Reproduction steps

  1. Run docker compose file
  2. Run official sample
  3. Observe crash

Expected behavior

Sample works without crashing

Additional context

No response

Gsantomaggio commented 6 months ago

Hi @CoenraadS

Can you add more information? Like:

Can you add the debug logs?

builder.AddFilter("RabbitMQ.Stream", LogLevel.Debug);

I am not able to reproduce the issue