{"record":{"id":"0909dca958f31c77","repo":"apache/seatunnel","slug":"edge-socket-receiver-executor-did-not-terminate-wi","errorCode":null,"errorMessage":"Edge socket receiver executor did not terminate within timeout","messagePattern":"Edge socket receiver executor did not terminate within timeout","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java","lineNumber":255,"sourceCode":"                                log.error(\n                                        \"Edge socket receiver thread fatal exception\",\n                                        receiverException);\n                                fatalReceiverException = receiverException;\n                                throw receiverException;\n                            }\n                        });\n    }\n\n    private void stopReceiverLoop() {\n        if (receiverFuture != null) {\n            receiverFuture.cancel(true);\n            receiverFuture = null;\n        }\n        if (receiverExecutor != null) {\n            receiverExecutor.shutdownNow();\n            try {\n                if (!receiverExecutor.awaitTermination(3, TimeUnit.SECONDS)) {\n                    log.warn(\"Edge socket receiver executor did not terminate within timeout\");\n                }\n            } catch (InterruptedException interruptedException) {\n                Thread.currentThread().interrupt();\n            } finally {\n                receiverExecutor = null;\n            }\n        }\n    }\n\n    private boolean isInterruptedDuringRetryWait() {\n        try {\n            TimeUnit.MILLISECONDS.sleep(config.getReconnectIntervalMs());\n            return false;\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            return true;\n        }\n    }","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java#L237-L273","documentation":"Warned by stopReceiverLoop() when the receiver executor does not terminate within the 3-second awaitTermination window after shutdownNow(). The stop() sequence continues (executor is nulled) but the underlying thread may still be briefly running, which can delay resource release or leave the port bound momentarily.","triggerScenarios":"stop() called while the receive loop is blocked in an operation that ignores interrupts and exceeds 3 seconds — e.g. a long accept() with a large soTimeout, a slow collector read, or a wedged write.","commonSituations":"Shutdown with an active collector streaming data, accept timeout configured very high (acceptTimeoutMs), container freeze/pause during shutdown, thread blocked on a stuck socket write.","solutions":["Reduce acceptTimeoutMs / socket timeouts so the loop notices interrupts promptly.","Increase the awaitTermination window if your shutdown budget allows, or poll isReceiverAlive() after stop().","Ensure collector connections are closed before stopping the server during graceful shutdown.","If it recurs, investigate the receiver thread's blocking point with a thread dump (jstack)."],"exampleFix":"// before\nif (!receiverExecutor.awaitTermination(3, TimeUnit.SECONDS)) { log.warn(...); }\n// after\nreceiverExecutor.awaitTermination(3, TimeUnit.SECONDS);\nif (!receiverExecutor.isTerminated()) { log.warn(...); receiverExecutor.awaitTermination(10, TimeUnit.SECONDS); }","handlingStrategy":"try-catch","validationCode":"// before stop()\nif (server.isReceiverAlive()) { log.info(\"receiver still alive; stopping with active collector connections may delay termination\"); }","typeGuard":null,"tryCatchPattern":"try { server.stop(); } catch (RuntimeException e) { log.warn(\"stop did not fully terminate receiver: {}\", e.getMessage()); }","preventionTips":["Keep acceptTimeoutMs moderate so accept() wakes up during shutdown","Close collector connections before stopping the server","Confirm termination with a liveness check after stop()","Capture a thread dump if the warning repeats to find the blocking call"],"tags":["lifecycle","shutdown","timeout","thread"],"backgroundTag":"request-timeout","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"}