apache/hadoop · error · IOException

Join on writer thread

Error message

Join on writer thread ${thread} timed out

What it means

stopWriter interrupts the block writer thread and joins it with xceiverStopTimeout; if the thread is still alive after the join, the stop failed and this error is thrown with the thread's stack trace.

Solutions

  1. Investigate why the writer thread did not finish (slow disk, downstream stall); check disk metrics and downstream DataNode logs.
  2. Increase timeouts only after ruling out hardware and network stalls.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Joining the replica writer thread times out after a write or finalize, because the writer is stalled.

Common situations: The replica writer thread did not stop within the join timeout, typically due to a blocked disk I/O. Check for slow or failing disks.

Understand the failure class


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

Appendix: source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplicaInPipeline.java:276

    while (true) {
      Thread thread = writer.get();
      if ((thread == null) || (thread == Thread.currentThread()) ||
          (!thread.isAlive())) {
        if (writer.compareAndSet(thread, null)) {
          return; // Done
        }
        // The writer changed.  Go back to the start of the loop and attempt to
        // stop the new writer.
        continue;
      }
      thread.interrupt();
      try {
        thread.join(xceiverStopTimeout);
        if (thread.isAlive()) {
          // Our thread join timed out.
          final String msg = "Join on writer thread " + thread + " timed out";
          DataNode.LOG.warn(msg + "\n" + StringUtils.getStackTrace(thread));
          throw new IOException(msg);
        }
      } catch (InterruptedException e) {
        throw new IOException("Waiting for writer thread is interrupted.");
      }
    }
  }

  @Override  // Object
  public int hashCode() {
    return super.hashCode();
  }

  @Override // ReplicaInPipeline
  public ReplicaOutputStreams createStreams(boolean isCreate,
      DataChecksum requestedChecksum) throws IOException {
    final File blockFile = getBlockFile();
    final File metaFile = getMetaFile();
    if (DataNode.LOG.isDebugEnabled()) {

View on GitHub (pinned to 2add963021)