cshannon commented on issue #3282:
URL: https://github.com/apache/accumulo/issues/3282#issuecomment-1500672319

   This was bugging me so I looked into why shutdown works and it's the JVM is 
halted so it never even hits that loop to wait.
   
   
   1. The manager sends a shutdown command to the Tserver. The Tserver gets it 
and eventually inside the TabletClientHandler it makes a call to 
[Halt.halt()](https://github.com/apache/accumulo/blob/main/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java#L1261)
 to initialize the JVM shutdown.
   2. The call to Halt.halt() executes a 
[runnable](https://github.com/apache/accumulo/blob/main/core/src/main/java/org/apache/accumulo/core/util/Halt.java#L60)
 which 
[sets](https://github.com/apache/accumulo/blob/main/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletClientHandler.java#L1264)
 the `serverStopRequested` to true so the loop inside of TabletServer breaks.
   3. Immediately after the runnable is finished halt continues and 
[halts](https://github.com/apache/accumulo/blob/main/core/src/main/java/org/apache/accumulo/core/util/Halt.java#L62)
 the JVM so the JVM shutsdown.
   
   The end result is the JVM has shutdown initialized at the same time so in my 
testing the JVM exited before the `shutdownComplete` block is ever hit so none 
of the code was even executed. I would assume in theory it could hit that 
[loop](https://github.com/apache/accumulo/blob/main/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java#L872)
 if the JVM took a while to shutdown. I guess in that guess it would just spin 
until the halt was finished.
   
   So it seems like based on the behavior (and the 
[comment](https://github.com/apache/accumulo/blob/main/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java#L865),
 although the comment is hard to understand) that this behavior of waiting on 
the JVM to halt is intentional so the JVM closes the other threads before that 
thread is exited. But if that's the case this is kind of a weird way to do it 
and not super clear and I also don't understand the point of all the other code 
that exists after the while loop as it won't ever be executed.


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