Chia-Ping Tsai created KAFKA-18274:
--------------------------------------

             Summary: 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: Improvement
            Reporter: Chia-Ping Tsai
            Assignee: Chia-Ping Tsai


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