{"record":{"id":"bb601291930ff12a","repo":"apache/hadoop","slug":"stream-is-closed-stream","errorCode":null,"errorMessage":"Stream is closed:  <stream>","messagePattern":"Stream is closed:  <stream>","errorType":"exception","errorClass":"ClosedIOException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java","lineNumber":354,"sourceCode":"   * Clear the active block.\n   */\n  private void clearActiveBlock() {\n    if (activeBlock != null) {\n      LOG.debug(\"Clearing active block\");\n    }\n    synchronized (this) {\n      activeBlock = null;\n    }\n  }\n\n  /**\n   * Check for the stream being open.\n   * @throws ClosedIOException if the stream is closed.\n   */\n  @VisibleForTesting\n  void checkOpen() throws ClosedIOException {\n    if (closed.get()) {\n      throw new ClosedIOException(key, \"Stream is closed:  \" + this);\n    }\n  }\n\n  /**\n   * The flush operation does not trigger an upload; that awaits\n   * the next block being full. What it does do is call {@code flush() }\n   * on the current block, leaving it to choose how to react.\n   * <p>\n   * If the stream is closed, a warning is logged but the exception\n   * is swallowed.\n   * @throws IOException Any IO problem flushing the active data block.\n   */\n  @Override\n  public synchronized void flush() throws IOException {\n    try {\n      checkOpen();\n    } catch (ClosedIOException e) {\n      LOG.warn(\"Stream closed: {}\", e.getMessage());","sourceCodeStart":336,"sourceCodeEnd":372,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java#L336-L372","documentation":"Error \"Stream is closed:  <stream>\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/S3ABlockOutputStream.java:354 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Do not write to the block output stream after close(); check calling code for use-after-close."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}