yandrey321 commented on PR #1664: URL: https://github.com/apache/ratis/pull/1664#issuecomment-6544595376
> Server groups are changed actually: 1.`NettyRpcService` uses `new NettyRpcProxy.PeerMap(id.toString(), server.getProperties())` > > https://github.com/apache/ratis/blob/2da35023579cbffce70f220a025b274aa29bddca/ratis-netty/src/main/java/org/apache/ratis/netty/server/NettyRpcService.java#L101 > > > 2. `NettyServerStreamRpc.newClient` builds a `DataStreamClient`, which uses `NettyClientStreamRpc`, to forward streams to other peers. Those forwarding threads become daemon threads as well. `NettyClientStreamRpc` eventually will be created against this > https://github.com/apache/ratis/blob/2da35023579cbffce70f220a025b274aa29bddca/ratis-netty/src/main/java/org/apache/ratis/netty/client/NettyClientStreamRpc.java#L120 > > It does not seem to be harmful to turn those server groups into daemon threads. But as the PR description says server groups are not changed, just pointing out to verify the intention and impact. You're right, thanks for checking. The description was wrong: two of the three groups are also created inside servers, so a server's outbound threads become daemon too: - `NettyRpcService` uses `NettyRpcProxy.PeerMap` for server-to-peer Netty RPC; - `NettyServerStreamRpc` forwards streams to other peers through a `DataStreamClient`, i.e. `NettyClientStreamRpc`. The servers' inbound groups are unchanged: `NettyRpcService`'s and `NettyServerStreamRpc`'s boss and worker groups, and `GrpcServicesImpl`'s boss and server-worker groups. So is `GrpcServicesImpl`'s `client-workers` group. On impact, I agree it's harmless, and I'd keep it rather than plumb a daemon flag through `PeerMap` and the stream client: - **It doesn't change when a server's JVM can exit.** The server's inbound groups, which are unchanged, keep the JVM alive while the server runs. These outbound threads only matter after the server is closed. - **Shutdown is unchanged.** Closing the server closes its `PeerMap` and stream clients, which shut these groups down gracefully, as before. - **The one difference is a leak, and it's in the right direction.** If a server is closed but one of these outbound groups wasn't, that group no longer keeps the JVM alive, the same reason the client groups changed. I've corrected the PR description to list the server-side uses and the groups that stay unchanged, with the reasoning above. -- 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]
