{"record":{"id":"b6d0523f0ae4044a","repo":"elastic/elasticsearch","slug":"process-was-found-dead-while-waiting-for","errorCode":null,"errorMessage":"process was found dead while waiting for {}, {}","messagePattern":"process was found dead while waiting for (.+?), (.+?)","errorType":"exception","errorClass":"TestClustersException","httpStatus":null,"severity":"critical","filePath":"build-tools/src/main/java/org/elasticsearch/gradle/testclusters/TestClusterConfiguration.java","lineNumber":145,"sourceCode":"    void stop(boolean tailLogs);\n\n    void setNameCustomization(Function<String, String> nameSupplier);\n\n    default void waitForConditions(\n        LinkedHashMap<String, Predicate<TestClusterConfiguration>> waitConditions,\n        long startedAtMillis,\n        long nodeUpTimeout,\n        TimeUnit nodeUpTimeoutUnit,\n        TestClusterConfiguration context\n    ) {\n        Logger logger = Logging.getLogger(TestClusterConfiguration.class);\n        waitConditions.forEach((description, predicate) -> {\n            long thisConditionStartedAt = System.currentTimeMillis();\n            boolean conditionMet = false;\n            Throwable lastException = null;\n            while (System.currentTimeMillis() - startedAtMillis < TimeUnit.MILLISECONDS.convert(nodeUpTimeout, nodeUpTimeoutUnit)) {\n                if (context.isProcessAlive() == false) {\n                    throw new TestClustersException(\"process was found dead while waiting for \" + description + \", \" + this);\n                }\n\n                try {\n                    if (predicate.test(context)) {\n                        conditionMet = true;\n                        break;\n                    }\n                } catch (TestClustersException e) {\n                    throw e;\n                } catch (Exception e) {\n                    lastException = e;\n                }\n            }\n            if (conditionMet == false) {\n                String message = String.format(\n                    Locale.ROOT,\n                    \"`%s` failed to wait for %s after %d %s\",\n                    context,","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools/src/main/java/org/elasticsearch/gradle/testclusters/TestClusterConfiguration.java#L127-L163","documentation":"Thrown inside TestClusterConfiguration.waitForConditions() when, while polling a wait predicate, `context.isProcessAlive()` returns false before the condition is satisfied. Each iteration first checks process liveness — if the node died mid-wait (e.g. during the `forming cluster` or `http ready` wait), it aborts immediately rather than timing out uselessly. The message names both the condition description and the cluster (`this`).","triggerScenarios":"A node process exits during one of the readiness waits (cluster formation, transport port bound, HTTP endpoint responding, plugin loaded). Any JVM exit — crash, OOM, fatal error, external kill — while a wait condition is still polling triggers this.","commonSituations":"Node crashes during bootstrap: missing required setting, classpath conflict, security realm misconfiguration, seed-node unreachable, lucene index corruption on a reused data dir, native lib failure. Distinct from #101 (which is the run-task's tailing loop); this is the startup readiness wait.","solutions":["Read the node's log file (the framework logs node output to its es output file) — the JVM exit reason is in the tail.","Check for bootstrap errors: invalid settings, unresolved plugins, missing security config, port already bound.","If reusing a data directory, clear it (`./gradlew <task> --rerun-tasks` or wipe the testclusters build dir) to rule out corruption.","Increase startup heap if the log shows OOM; verify the seed/unicast hosts files were written (the run task calls `writeUnicastHostsFiles()`)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  cluster.waitForConditions(...);\n} catch (TestClustersException e) {\n  if (e.getMessage().contains(\"process was found dead\")) {\n    // dump the node log tail for post-mortem\n    log.error(\"Node died during startup wait; see node log.\");\n  }\n  throw e;\n}","preventionTips":["Validate cluster config (settings, plugins, security realm) before startup to avoid bootstrap crashes.","Avoid reusing data directories across incompatible versions; clean them between runs.","Ensure required ports are free and seed nodes reachable before the wait begins."],"tags":["gradle","testclusters","startup","process-lifecycle","build-tools"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}