elastic/elasticsearch · warning · TestClustersException

Interrupted while waiting for ports files

Error message

Interrupted while waiting for ports files

What it means

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.

Source

Thrown at build-tools/src/main/java/org/elasticsearch/gradle/testclusters/ElasticsearchNode.java:1724

    private String id() {
        return "node{" + path + ":" + name + "}";
    }

    @Input
    List<Map<String, String>> getCredentials() {
        return credentials;
    }

    private boolean checkPortsFilesExistWithDelay(TestClusterConfiguration node) {
        if (Files.exists(httpPortsFile) && Files.exists(transportPortFile)) {
            return true;
        }
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new TestClustersException("Interrupted while waiting for ports files", e);
        }
        return Files.exists(httpPortsFile) && Files.exists(transportPortFile);
    }

    @Internal
    public boolean isHttpSslEnabled() {
        return Boolean.parseBoolean(settings.getOrDefault("xpack.security.http.ssl.enabled", "false").toString());
    }

    void configureHttpWait(WaitForHttpResource wait) {
        if (settings.containsKey("xpack.security.http.ssl.certificate")) {
            wait.setServerCertificate(getConfigDir().resolve(settings.get("xpack.security.http.ssl.certificate").toString()).toFile());
        } else {
            if (settings.containsKey("xpack.security.http.ssl.keystore.path")) {
                wait.setServerKeystoreFile(
                    getConfigDir().resolve(settings.get("xpack.security.http.ssl.keystore.path").toString()).toFile()
                );
            }

View on GitHub (pinned to db6a809a66)

Solutions

  1. If user-initiated cancellation, ignore — the test framework will report the cancellation separately.
  2. If unexpected, check gradle daemon health (memory, timeout settings) for why the thread was interrupted.
  3. If the ports genuinely never appear, investigate the node startup itself (error 93/94 root cause) rather than this interrupt.
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Thread.sleep(500);
} catch (InterruptedException e) {
    Thread.currentThread().interrupt();
    throw new TestClustersException("Interrupted while waiting for ports files", e);
}

Prevention

When it happens

Trigger: 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.

Common situations: Build cancellation (Ctrl-C), gradle daemon eviction, or a test-framework timeout interrupting the startup wait. Often benign when user-initiated.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/bbe0fa79ad4052fa. Report an issue: GitHub.