{"record":{"id":"b911010863a8164d","repo":"apache/seatunnel","slug":"close-event-processor-error","errorCode":null,"errorMessage":"close event processor error","messagePattern":"close event processor error","errorType":"exception","errorClass":"SeaTunnelEngineException","httpStatus":null,"severity":"error","filePath":"seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java","lineNumber":1348,"sourceCode":"            Thread.currentThread().interrupt();\n            logger.info(\n                    \"Coordinator service shutdown interrupted while waiting executorService termination, continue cleanup.\");\n        }\n\n        ResourceManager manager = resourceManager;\n        resourceManager = null;\n        if (manager != null) {\n            manager.close();\n        }\n\n        try {\n            EventProcessor processor = eventProcessor;\n            eventProcessor = null;\n            if (processor != null) {\n                processor.close();\n            }\n        } catch (Exception e) {\n            throw new SeaTunnelEngineException(\"close event processor error\", e);\n        }\n    }\n\n    /** Lazy load for resource manager */\n    public ResourceManager getResourceManager() {\n        if (resourceManager == null) {\n            synchronized (this) {\n                if (resourceManager == null) {\n                    ResourceManager manager =\n                            new ResourceManagerFactory(nodeEngine, engineConfig)\n                                    .getResourceManager();\n                    manager.init();\n                    resourceManager = manager;\n                }\n            }\n        }\n        return resourceManager;\n    }","sourceCodeStart":1330,"sourceCodeEnd":1366,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/CoordinatorService.java#L1330-L1366","documentation":"CoordinatorService throws this SeaTunnelEngineException when it fails to shut down the engine's EventProcessor during engine/node close. The EventProcessor dispatches engine events to registered listeners; if its close() raises any Exception, the shutdown step is aborted with this wrapping error. It indicates a failure in an event listener's cleanup, not in job processing itself.","triggerScenarios":"Engine/node shutdown (SeaTunnelServer.stop or node shutdown hook) when an EventProcessor exists and one of its registered EventListener implementations throws during EventProcessor.close().","commonSituations":"Custom or third-party event listeners that perform network I/O in close() without handling errors; unreachable remote event sink at shutdown time; concurrent shutdown from multiple code paths.","solutions":["Inspect the caused-by chain to find which EventListener.close() threw and fix that listener's cleanup logic.","Wrap custom event listener close/flush logic in try-catch so it logs instead of throwing.","Ensure shutdown is invoked only once (single shutdown hook); the processor reference is nulled before close, so a repeat close is safe.","Retry shutdown after fixing the listener; this error does not leave the engine in an inconsistent state."],"exampleFix":"// before: listener that throws during close\npublic void close() {\n    httpClient.post(pendingEvents); // network error propagates\n}\n// after: tolerate errors on shutdown path\npublic void close() {\n    try { httpClient.post(pendingEvents); }\n    catch (Exception e) { log.warn(\"failed to flush events on close\", e); }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    engine.close();\n} catch (SeaTunnelEngineException e) {\n    if (e.getMessage().contains(\"close event processor error\")) {\n        log.warn(\"event processor close failed during shutdown\", e.getCause());\n    } else { throw e; }\n}","preventionTips":["Wrap custom EventListener close logic in try-catch and log instead of throwing.","Avoid blocking network I/O in event listener cleanup.","Register a single shutdown path to avoid concurrent close.","Keep the set of registered event listeners minimal on production nodes."],"tags":["shutdown","zeta-engine","event-processor"],"backgroundTag":"internal-invariant-violation","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}