{"record":{"id":"5b7354efe9a0473e","repo":"apache/druid","slug":"failed-to-flush-one-or-more-emitters","errorCode":null,"errorMessage":"failed to flush one or more emitters","messagePattern":"failed to flush one or more emitters","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/java/util/emitter/core/ComposingEmitter.java","lineNumber":79,"sourceCode":"  @Override\n  public void flush() throws IOException\n  {\n    boolean fail = false;\n    log.info(\"Flushing Composing Emitter.\");\n\n    for (Emitter e : emitters) {\n      try {\n        log.info(\"Flushing emitter %s.\", e.getClass().getName());\n        e.flush();\n      }\n      catch (IOException ex) {\n        log.error(ex, \"Failed to flush emitter [%s]\", e.getClass().getName());\n        fail = true;\n      }\n    }\n\n    if (fail) {\n      throw new IOException(\"failed to flush one or more emitters\");\n    }\n  }\n\n  @Override\n  @LifecycleStop\n  public void close() throws IOException\n  {\n    boolean fail = false;\n    log.info(\"Closing Composing Emitter.\");\n\n    for (Emitter e : emitters) {\n      try {\n        log.info(\"Closing emitter %s.\", e.getClass().getName());\n        e.close();\n      }\n      catch (IOException ex) {\n        log.error(ex, \"Failed to close emitter [%s]\", e.getClass().getName());\n        fail = true;","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/java/util/emitter/core/ComposingEmitter.java#L61-L97","documentation":"ComposingEmitter.flush() delegates flush to each of its composed child emitters, logging and remembering any child failure. If at least one child emitter failed to flush, it throws IOException 'failed to flush one or more emitters' after attempting all children, so callers know buffered events may not have been delivered.","triggerScenarios":"Calling flush() on a ComposingEmitter when any wrapped emitter (e.g. HttpPostEmitter) fails its flush due to I/O errors, closed emitters, or unreachable recipients.","commonSituations":"Shutdown-time flush when a remote metrics/alert endpoint is down; network partitions during event delivery; child emitter already closed; timeouts on HTTP emitters.","solutions":["Check the logs for 'Failed to flush emitter [...]' entries to identify which child emitter failed","Ensure the backing services/URLs of all child emitters are reachable before flushing","Retry flush() after connectivity is restored, since some children may have succeeded","Wrap flush in try/catch during shutdown to avoid masking the primary shutdown error"],"exampleFix":"// before\nemitter.flush(); // may throw IOException on shutdown\n// after\ntry {\n  emitter.flush();\n} catch (IOException e) {\n  log.error(e, \"Some emitters failed to flush; events may be lost\");\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  emitter.flush();\n} catch (IOException e) {\n  log.error(e, \"One or more emitters failed to flush; check child emitter logs\");\n}","preventionTips":["Check logs for 'Failed to flush emitter [...]' to find the failing child","Verify recipient endpoint connectivity before relying on flush for delivery","Retry flush after transient network failures","Flush before close so close has less work to do at shutdown"],"tags":["io","flush","emitter","druid"],"backgroundTag":"file-write-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}