[ 
https://issues.apache.org/jira/browse/KAFKA-18274?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Chia-Ping Tsai resolved KAFKA-18274.
------------------------------------
    Resolution: Fixed

> Failed to restart controller in testing due to closed socket channel
> --------------------------------------------------------------------
>
>                 Key: KAFKA-18274
>                 URL: https://issues.apache.org/jira/browse/KAFKA-18274
>             Project: Kafka
>          Issue Type: Bug
>            Reporter: Chia-Ping Tsai
>            Assignee: Peter Lee
>            Priority: Major
>             Fix For: 4.1.0
>
>
> In fact, there are three issues of restarting controller in testing.
> 1. we don't rebuild the metrics of `SharedServer` [0] - it causes NPE
> 2. we return the closed server socket [1]
> 3. we should return the new server socket bound with same port
> ```
>             if (socketChannel != null && socketChannel.isOpen()) {
>                 return socketChannel;
>             }
>             // bind the server socket with same port
>             if (socketChannel != null) {
>                 socketAddress = new 
> InetSocketAddress(socketAddress.getHostString(), 
> socketChannel.socket().getLocalPort());
>             }
> ```
> [0] 
> https://github.com/apache/kafka/blob/trunk/core/src/main/scala/kafka/server/ControllerServer.scala#L161
> [1] 
> https://github.com/apache/kafka/blob/trunk/test-common/src/main/java/org/apache/kafka/common/test/PreboundSocketFactoryManager.java#L52



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to