apache/hadoop · error · ClosedIOException

KeepAliveCache is closed

Error message

KeepAliveCache is closed

What it means

Lifecycle guard on the keep-alive connection cache: get() was called after close() had already drained and closed all cached HttpClientConnections, so no pooled connection can be handed out.

Solutions

  1. Do not use the HTTP connection keep-alive cache after the filesystem/client is closed.
  2. Open a new filesystem instance for further operations.
Defensive patterns

Strategy: validation

When it happens

Trigger: Code attempts to reuse the keep-alive cache after the ABFS client shut it down.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/d92a94cd01aebc62. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/services/KeepAliveCache.java:208

    while (size() != 0) {
      closeHttpClientConnection(pollFirst());
    }
  }

  /**
   * Gets the oldest added HttpClientConnection from the cache. The returned connection
   * is open.
   * The cache follows the FIFO strategy. If the connection is not open, it will
   * be closed and the next connection is checked. Once a valid connection is found,
   * it is returned.
   * @return HttpClientConnection: if a valid connection is found, else null.
   * @throws IOException if the cache is closed.
   */
  public HttpClientConnection get() throws IOException {
    if (getIsClosed()) {
      LOG.debug("Attempt to get connection from closed cache for account: {}",
          accountNamePath);
      throw new ClosedIOException(accountNamePath, KEEP_ALIVE_CACHE_CLOSED);
    }
    HttpClientConnection httpClientConnection;
    while ((httpClientConnection = pollFirst()) != null) {
      if (!httpClientConnection.isOpen() || httpClientConnection.isStale()) {
        closeHttpClientConnection(httpClientConnection);
        continue;
      }
      return httpClientConnection;
    }
    LOG.debug("No valid connection found in cache for account: {}",
        accountNamePath);
    return null;
  }

  /**
   * Puts the HttpClientConnection in the cache. If the size of cache is equal to
   * maxConn, the oldest connection is closed and removed from the cache, which
   * will make space for the new connection. If the cache is closed or of zero size,

View on GitHub (pinned to 2add963021)