drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilooner <...@git.apache.org>
Subject [GitHub] drill pull request #1023: DRILL-5922 Fixed Child Allocator Leak. DRILL-5926 ...
Date Tue, 07 Nov 2017 02:10:33 GMT
Github user ilooner commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1023#discussion_r149257392
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/work/WorkManager.java ---
    @@ -158,38 +165,49 @@ public DrillbitContext getContext() {
         return dContext;
       }
     
    -  private ExtendedLatch exitLatch = null; // used to wait to exit when things are still
running
    -
       /**
        * Waits until it is safe to exit. Blocks until all currently running fragments have
completed.
    -   *
    -   * <p>This is intended to be used by {@link org.apache.drill.exec.server.Drillbit#close()}.</p>
    +   * This is intended to be used by {@link org.apache.drill.exec.server.Drillbit#close()}.
        */
       public void waitToExit() {
    -    synchronized(this) {
    -      if (queries.isEmpty() && runningFragments.isEmpty()) {
    -        return;
    +    final long startTime = System.currentTimeMillis();
    +    final long endTime = startTime + EXIT_TIMEOUT;
    +
    +    exitLock.lock();
    +
    +    try {
    +      long currentTime;
    +      while ((currentTime = System.currentTimeMillis()) < endTime) {
    +        if (queries.isEmpty() && runningFragments.isEmpty()) {
    +          break;
    +        }
    +
    +        try {
    +          if (!exitCondition.await(endTime - currentTime, TimeUnit.MILLISECONDS)) {
    +            break;
    +          }
    +        } catch (InterruptedException e) {
    +          logger.error("Interrupted while waiting to exit");
    +        }
           }
     
    -      exitLatch = new ExtendedLatch();
    -    }
    +      if (!(queries.isEmpty() && runningFragments.isEmpty())) {
    +        logger.warn("Timed out after {} millis. Shutting down before all fragments and
foremen " +
    --- End diff --
    
    Done


---

Mime
View raw message