Skip to content

LoadbalancerPool should remove targets which it fails to connect #958

Closed

Description

@pckeyan

I am trying to add the following nodes to the Load balancer as below:

LoadbalanceTarget target9000 = LoadbalanceTarget.from("9000", TcpClientTransport.create("localhost",9000));
        LoadbalanceTarget target9001 = LoadbalanceTarget.from("9001", TcpClientTransport.create("localhost",9001));
        LoadbalanceTarget target9002 = LoadbalanceTarget.from("9002", TcpClientTransport.create("localhost",9002));
        ArrayList<LoadbalanceTarget> serverFarm = new ArrayList<>();
        serverFarm.add(target9000);
        serverFarm.add(target9001);
        serverFarm.add(target9002);
        Flux<List<LoadbalanceTarget>> producer = Flux.fromIterable(serverFarm).collectList().flux();
        RSocketClient rSocketClient =
                LoadbalanceRSocketClient.builder(producer).roundRobinLoadbalanceStrategy().build();

While in the process of the application start up, one of the node failed and not available.

Expected Behavior

Load Balancer should gracefully not use the node that is not reachable.

Actual Behavior

Client application fails to start with following exception:

io.netty.channel.AbstractChannel$AnnotatedConnectException: Connection refused: localhost/127.0.0.1:9002
Caused by: java.net.ConnectException: Connection refused
	at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
	at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
	at io.netty.channel.socket.nio.NioSocketChannel.doFinishConnect(NioSocketChannel.java:330)
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.finishConnect(AbstractNioChannel.java:334)
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:702)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.lang.Thread.run(Thread.java:748)

Possible Solution

Loadbalancer should gracefully not send the request to the unavailable node and application should continue to process requests in other nodes.

Your Environment

   <parent>
        <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.5.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-core</artifactId>
            <version>3.4.0</version>
    </dependency>
  • RSocket version(s) used: 1.1.0

  • Other relevant libraries versions (eg. netty, ...):

  • Platform (eg. JVM version (javar -version) or Node version (node --version)): Java 8

  • OS and version (eg uname -a): Mac

Activity

  1. added this to the 1.1.1 milestone on Nov 6, 2020
  2. changed the title [-]Application Fails to start if a node is unavailable for the LoadBalancer[/-] [+]LoadbalancerPool should remove targets which it fails to connect[/+] on Feb 17, 2021
  3. added a commit that references this issue on Feb 17, 2021
    7c4305a
  4. rstoyanchev commented on Feb 18, 2021

    @rstoyanchev
    Contributor

    Superseded by #982.

  5. removed this from the 1.1.1 milestone on Feb 18, 2021
  6. added a commit that references this issue on Jan 24, 2025
    9baf974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions