apache/hadoop · error · IllegalStateException

Missing response

Error message

Missing response

What it means

FsPathResponseRunner expects a JSON body for a successful WebHDFS operation. jsonParse returns null when the HTTP connection reports a content length of zero, and getResponse converts that null into IllegalStateException('Missing response'), which is then wrapped as IOException('Response decoding failure: ...'). The operation therefore succeeded at the HTTP layer but returned no decodable payload.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/WebHdfsFileSystem.java:969

   */
  abstract class FsPathResponseRunner<T> extends AbstractFsPathRunner<T> {
    FsPathResponseRunner(final HttpOpParam.Op op, final Path fspath,
        Param<?,?>... parameters) {
      super(op, fspath, parameters);
    }

    FsPathResponseRunner(final HttpOpParam.Op op, Param<?,?>[] parameters,
        final Path fspath) {
      super(op, parameters, fspath);
    }

    @Override
    final T getResponse(HttpURLConnection conn) throws IOException {
      try {
        final Map<?,?> json = jsonParse(conn, false);
        if (json == null) {
          // match exception class thrown by parser
          throw new IllegalStateException("Missing response");
        }
        return decodeResponse(json);
      } catch (IOException ioe) {
        throw ioe;
      } catch (Exception e) { // catch json parser errors
        final IOException ioe =
            new IOException("Response decoding failure: "+e.toString(), e);
        LOG.debug("Response decoding failure.", e);
        throw ioe;
      } finally {
        // Don't call conn.disconnect() to allow connection reuse
        // See http://tinyurl.com/java7-http-keepalive
        conn.getInputStream().close();
      }
    }

    abstract T decodeResponse(Map<?,?> json) throws IOException;
  }

View on GitHub (pinned to 2add963021)

Solutions

  1. Replay the exact request with curl -i and confirm whether the expected success status has Content-Length: 0.
  2. Check reverse-proxy, HttpFS, and NameNode logs for body truncation or filter interception on that path.
  3. Retry once on a new connection to rule out stale keep-alive sockets, then fail over to another NameNode if available.
  4. Repair the gateway or mock so successful WebHDFS operations return the documented application/json body.

Example fix

// before
FileStatus status = fs.getFileStatus(path); // 200 with empty body

// after: bounded retry on a fresh connection
for (int attempt = 0; attempt < 2; attempt++) {
  try {
    return fs.getFileStatus(path);
  } catch (IOException e) {
    if (attempt == 0 && e.toString().contains("Missing response")) {
      continue;
    }
    throw e;
  }
}
throw new IOException("WebHDFS repeatedly returned an empty response");
Defensive patterns

Strategy: retry

Try / catch

IOException last = null;
for (int attempt = 0; attempt < 2; attempt++) {
  try {
    return fs.getFileStatus(path);
  } catch (IOException e) {
    last = e;
    if (e.toString().contains("Missing response") && attempt == 0) {
      continue;
    }
    throw e;
  }
}
throw last;

Prevention

When it happens

Trigger: A WebHDFS request receives its expected success status with an empty body, for example a gateway or filter returning 200/204 with no JSON. Any API implemented through FsPathResponseRunner, such as GETFILESTATUS, GETACLSTATUS, or GETFILECHECKSUM, can encounter it.

Common situations: A proxy or HttpFS gateway strips the response body; keep-alive reuse yields an empty response after a connection problem; a custom filter or mock returns success without forwarding JSON; a server bug produces an empty success response.

Related errors


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