adoroszlai commented on code in PR #977:
URL: https://github.com/apache/ratis/pull/977#discussion_r1412757312
##########
ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientStreamRpc.java:
##########
@@ -260,6 +266,8 @@ synchronized boolean write(DataStreamRequest request) {
synchronized boolean shouldFlush(boolean force, int countMin, SizeInBytes
bytesMin) {
if (force || count >= countMin || bytes >= bytesMin.getSize()) {
+ LOG.debug("flush: force? {}, (count, bytes)=({}, {}), min=({}, {})",
+ force, count, bytes, countMin, bytesMin);
Review Comment:
`Connection refused` may still happen in the following case: when shutting
down all nodes in the group, server of one node may be shutdown before peer
proxy of that server in another node.
server:
```
2023-12-02 09:01:32,887
[008c6bcb-05b6-400c-87dc-2e492505ab22-NettyServerStreamRpc-bossGroup--thread1]
INFO logging.LoggingHandler (AbstractInternalLogger.java:log(148)) - [id:
0xef0ee84e, L:/0.0.0.0:15024] CLOSE
2023-12-02 09:01:32,888
[008c6bcb-05b6-400c-87dc-2e492505ab22-NettyServerStreamRpc-bossGroup--thread1]
INFO logging.LoggingHandler (AbstractInternalLogger.java:log(148)) - [id:
0xef0ee84e, L:/0.0.0.0:15024] INACTIVE
2023-12-02 09:01:32,888
[008c6bcb-05b6-400c-87dc-2e492505ab22-NettyServerStreamRpc-bossGroup--thread1]
INFO logging.LoggingHandler (AbstractInternalLogger.java:log(148)) - [id:
0xef0ee84e, L:/0.0.0.0:15024] UNREGISTERED
```
client in peer:
```
2023-12-02 09:01:32,893 [Thread-999] DEBUG client.NettyClientStreamRpc
(NettyClientStreamRpc.java:shouldFlush(269)) - flush: force? true, (count,
bytes)=(0, 0), min=(0, 0)
2023-12-02 09:01:32,897 [Thread-999] WARN util.PeerProxyMap
(PeerProxyMap.java:closeProxy(170)) -
c8994a5a-9b0d-4fa4-993e-22bc1af8386e-NettyServerStreamRpc: Failed to close
proxy for peer 008c6bcb-05b6-400c-87dc-2e492505ab22|127.0.0.1:15023, proxy
class: class org.apache.ratis.client.impl.DataStreamClientImpl
org.apache.ratis.thirdparty.io.netty.channel.AbstractChannel$AnnotatedConnectException:
finishConnect(..) failed: Connection refused: /127.0.0.1:15024
```
I think the problem is that during close `shouldFlush` always returns `true`
due to `force=true`. So closing the peer proxy tries to reconnect to send the
empty byte buffer.
https://github.com/apache/ratis/blob/d5019c1c7b0f65952aa88f0e81780a1b32befd89/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientStreamRpc.java#L456-L464
Should we really force flush when there is no data to be sent?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]