apache/cassandra · error · RuntimeException

Error during clearing snapshots

Error message

Error during clearing snapshots

What it means

Nodetool's ClearSnapshot wraps any IOException from the JMX call NodeProbe.clearSnapshot (which invokes StorageServiceMBean.takeSnapshot-style snapshot removal remotely) into a RuntimeException. It means the nodetool client could not communicate the clear-snapshots request to the node or the operation failed at the transport level. The snapshot data itself is not removed.

Solutions

  1. Verify the node is up and JMX is reachable: `nodetool status` against the same host/port.
  2. Check JMX connection settings (-p port, -u/-pw, SSL flags) in the nodetool command.
  3. Inspect the wrapped cause (printed as 'Caused by') for the underlying IOException detail.
  4. Retry after the node recovers; snapshot clearing is idempotent.

Example fix

// before
nodetool -h 10.0.0.5 clearsnapshot
// after
nodetool -h 10.0.0.5 -p 7199 -u jmxuser -pw jmxpass clearsnapshot  # correct port/creds
Defensive patterns

Strategy: try-catch

Validate before calling

// check JMX reachability before clearing
try (JMXConnector c = JMXConnectorFactory.connect(new JMXServiceURL("service:jmx:rmi:///jndi/rmi://host:7199/jmxrmi"))) {
    c.getMBeanServerConnection().getDomains(); // probe connectivity
}

Try / catch

try { probe.clearSnapshot(params, name, keyspaces); }
catch (RuntimeException e) {
    Throwable cause = e.getCause();
    if (cause instanceof java.io.IOException) { /* node unreachable; alert + retry later */ }
    else throw e;
}

Prevention

When it happens

Trigger: Running `nodetool clearsnapshot` (with optional --before-timestamp, snapshot names, or keyspaces) when the JMX connection to the node breaks or the remote call throws IOException, e.g. node down mid-command or JMX auth/SSL failure.

Common situations: JMX port (default 7199) wrong or firewalled; Cassandra node stopped or crashed while clearing snapshots; JMX remote SSL/username-password misconfiguration; connecting to a node of a mismatched Cassandra version.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/bf29d8611d9ef56d. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/ClearSnapshot.java:129

        if (olderThanTimestamp != null)
            sb.append(" older than timestamp ").append(olderThanTimestamp);

        probe.output().out.println(sb);

        try
        {
            Map<String, Object> parameters = new HashMap<>();
            if (olderThan != null)
                parameters.put("older_than", olderThan);
            if (olderThanTimestamp != null)
                parameters.put("older_than_timestamp", olderThanTimestamp);

            probe.clearSnapshot(parameters, snapshotName, toArray(keyspaces, String.class));
        }
        catch (IOException e)
        {
            throw new RuntimeException("Error during clearing snapshots", e);
        }
    }
}

View on GitHub (pinned to 88fd0f6a0e)