[ 
https://issues.apache.org/jira/browse/ARTEMIS-2408?focusedWorklogId=278358&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-278358
 ]

ASF GitHub Bot logged work on ARTEMIS-2408:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 17/Jul/19 18:02
            Start Date: 17/Jul/19 18:02
    Worklog Time Spent: 10m 
      Work Description: clebertsuconic commented on pull request #2759: 
ARTEMIS-2408 Too many opened FDs after server stops
URL: https://github.com/apache/activemq-artemis/pull/2759#discussion_r304568592
 
 

 ##########
 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:
   This is actually a fix for NetworkFailureFailoverTest. So no need for a test.
   
   
   (@brusdev  please mention this is fixing networkFailureFailoverTest after 
reapplying the commit)
   
   
   NetworkFailureFailoverTest was actually added to prevent a situation where a 
network card gone wouldn't prevent a server from stopping.
   
   Instead of hunging during a shutdown the server will wait on a timeout, and 
the process will die and the OS will take care of cleaning up resources on that 
failure case.
   
   
   On a regular scenario these will run really fast and never take very long.
 
----------------------------------------------------------------
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]


Issue Time Tracking
-------------------

    Worklog Id:     (was: 278358)
    Time Spent: 4h 50m  (was: 4h 40m)

> Too many opened FDs after server stops
> --------------------------------------
>
>                 Key: ARTEMIS-2408
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2408
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>            Reporter: Domenico Bruscino
>            Priority: Major
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> The number of opened FDs after stop the server on the testsuite is much 
> higher than the number before the server is started, when default netty 
> configuration is used.
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to