michaelpearce-gain commented on a change in pull request #2759: ARTEMIS-2408 
Too many opened FDs after server stops
URL: https://github.com/apache/activemq-artemis/pull/2759#discussion_r304570722
 
 

 ##########
 File path: 
artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java
 ##########
 @@ -407,15 +408,28 @@ public void stop(final boolean criticalError) throws 
Exception {
          conn.disconnect(criticalError);
       }
 
+      Map<Acceptor, Future<?>> acceptorFutures = new HashMap<>();
       for (Acceptor acceptor : acceptors.values()) {
          try {
-            acceptor.stop();
+            acceptorFutures.put(acceptor, acceptor.asyncStop());
          } catch (Throwable t) {
             
ActiveMQServerLogger.LOGGER.errorStoppingAcceptor(acceptor.getName());
          }
       }
 
+      long acceptorTimeout = System.currentTimeMillis() + 3000;
+      for (Map.Entry<Acceptor, Future<?>> acceptorFuture : 
acceptorFutures.entrySet()) {
+         if (acceptorFuture.getValue() != null) {
+            try {
+               acceptorFuture.getValue().get(Math.max(0, acceptorTimeout - 
System.currentTimeMillis()), TimeUnit.MILLISECONDS);
 
 Review comment:
   I assume though that test case existed already right? I think it was added 
along with the fix after some physcial testing i had done in a previous life. 
And was previously passing, in past releases...
   
   So why is this needed, what broke it, and why. Very cautious in areas like 
this especially after it was only found on physical failure testing. Sorry if 
im sucking eggs.
   
   Also has a physical test (manual) been done to ensure it still works. As we 
know simulated tests here never quite as good as physically validating.
   
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to