{"record":{"id":"bbe0fa79ad4052fa","repo":"elastic/elasticsearch","slug":"interrupted-while-waiting-for-ports-files","errorCode":null,"errorMessage":"Interrupted while waiting for ports files","messagePattern":"Interrupted while waiting for ports files","errorType":"exception","errorClass":"TestClustersException","httpStatus":null,"severity":"warning","filePath":"build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java","lineNumber":1724,"sourceCode":"\n    private String id() {\n        return \"node{\" + path + \":\" + name + \"}\";\n    }\n\n    @Input\n    List<Map<String, String>> getCredentials() {\n        return credentials;\n    }\n\n    private boolean checkPortsFilesExistWithDelay(TestClusterConfiguration node) {\n        if (Files.exists(httpPortsFile) && Files.exists(transportPortFile)) {\n            return true;\n        }\n        try {\n            Thread.sleep(500);\n        } catch (InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new TestClustersException(\"Interrupted while waiting for ports files\", e);\n        }\n        return Files.exists(httpPortsFile) && Files.exists(transportPortFile);\n    }\n\n    @Internal\n    public boolean isHttpSslEnabled() {\n        return Boolean.parseBoolean(settings.getOrDefault(\"xpack.security.http.ssl.enabled\", \"false\").toString());\n    }\n\n    void configureHttpWait(WaitForHttpResource wait) {\n        if (settings.containsKey(\"xpack.security.http.ssl.certificate\")) {\n            wait.setServerCertificate(getConfigDir().resolve(settings.get(\"xpack.security.http.ssl.certificate\").toString()).toFile());\n        } else {\n            if (settings.containsKey(\"xpack.security.http.ssl.keystore.path\")) {\n                wait.setServerKeystoreFile(\n                    getConfigDir().resolve(settings.get(\"xpack.security.http.ssl.keystore.path\").toString()).toFile()\n                );\n            }","sourceCodeStart":1706,"sourceCodeEnd":1742,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java#L1706-L1742","documentation":"Thrown by checkPortsFilesExistWithDelay when Thread.sleep(500) is interrupted while waiting for the http and transport ports files to appear. The method restores the interrupt flag (Thread.currentThread().interrupt()) before throwing, which is correct interrupt etiquette. This is a startup-readiness helper.","triggerScenarios":"A gradle task or framework interrupts the thread during the 500ms sleep between the two existence checks of httpPortsFile/transportPortFile. The first check returned false, so the method sleeps and re-checks; interruption during that sleep triggers the throw.","commonSituations":"Build cancellation (Ctrl-C), gradle daemon eviction, or a test-framework timeout interrupting the startup wait. Often benign when user-initiated.","solutions":["If user-initiated cancellation, ignore — the test framework will report the cancellation separately.","If unexpected, check gradle daemon health (memory, timeout settings) for why the thread was interrupted.","If the ports genuinely never appear, investigate the node startup itself (error 93/94 root cause) rather than this interrupt."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    Thread.sleep(500);\n} catch (InterruptedException e) {\n    Thread.currentThread().interrupt();\n    throw new TestClustersException(\"Interrupted while waiting for ports files\", e);\n}","preventionTips":["Treat this interrupt as benign if the build was cancelled.","Investigate node startup root cause (errors 93/94) rather than this symptom."],"tags":["testclusters","ports","interruption","startup"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}