amaliujia commented on PR #1664:
URL: https://github.com/apache/ratis/pull/1664#issuecomment-6560034098

   Ok just summarize and then merge:
   
   For the client side, given the special setup of the application, it sounds 
like the application cannot pro-actively close the Ratis client but has to only 
rely on a JVM shutdown hook. Because of the non-daemon client threads, JVM 
cannot shutdown, so the application halts until a timeout. For this pattern, it 
would help after we change non-daemon thread to deamon thread for Ratis clients 
(that are used in application JVM).
   
   
   For the not really intended but happen to change bits: the outbound threads 
of the server: because the inbound threads are still non-daemon (guaranteed by 
the default daemon value in thread creation), the server will still block JVM 
shutdown unless the `close` is called explicitly. This is intended behavior 
that the system that uses Ratis should close Ratis server by using the `close` 
code path. Even then, the `close` code path pro-actively closes the outbound 
threads already.
   
   It could only change the behavior for servers as of now when an outbound 
thread is "leaked", meaning that a outbound thread is not properly closed by 
the `close` path in a normal exit (because Ratis expects to exit through 
`close` path, and if not, the inbounds threads as non-daemon thread will stop 
the JVM shutdown). The leaking is a bug, and we should always try to close the 
outbound threads in the normal `close` path. When we identify it, we should fix 
it.
   


-- 
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]

Reply via email to