apache/cassandra · error · ConfigurationException
CloudstackSnitch cannot access lease file.
Error message
CloudstackSnitch cannot access lease file.
What it means
Thrown by CloudstackLocationProvider.csEndpointFromLease() when reading/parsing the DHCP lease file throws (file unreadable, permissions, unexpected content). It reports that the CloudStack metadata endpoint could not be extracted from the lease file.
Solutions
- Grant read permission on the lease file to the cassandra process user
- Run the node with sufficient privileges or mount the lease file readable
- Verify lease file contents are well-formed dhclient lease entries
- Regenerate the lease by restarting dhclient/networking
Example fix
// before -rw------- root /var/lib/dhcp/dhclient.eth0.leases // after sudo chmod 644 /var/lib/dhcp/dhclient.eth0.leases
Defensive patterns
Strategy: try-catch
Validate before calling
File lease = new File(path);
if (!lease.canRead()) throw new IllegalStateException("Lease file not readable by user " + System.getProperty("user.name")); Try / catch
try { endpoint = csEndpointFromLease(lease); } catch (ConfigurationException e) { logger.error("Cannot read CloudStack lease file", e); throw e; } Prevention
- Ensure cassandra user has read access to /var/lib/dhcp/*
- Do not remove/rename lease files while Cassandra runs
- Validate lease file format after network stack changes
When it happens
Trigger: csEndpointFromLease(), invoked from csMetadataEndpoint(), when the lease file exists but cannot be read or parsed — bad permissions, missing file between listing and reading, malformed lease content causing BufferedReader exceptions.
Common situations: Lease file owned by root/dhcp user without read permission for the cassandra process; truncated or corrupted dhclient lease; running as non-root in a hardened container.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- CloudstackSnitch cannot handle invalid zone format
- No metadata server could be found in lease file.
- No valid DHCP lease file could be found.
- --all-tables option should be passed along with --keyspace…
- Altering permissions on builtin functions is not supported
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/fc08fce5969d40da.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/locator/CloudstackLocationProvider.java:125
Pattern identifierPattern = Pattern.compile("^[ \t]*option dhcp-server-identifier (.*);$");
try (BufferedReader reader = new BufferedReader(new FileReader(lease)))
{
while ((line = reader.readLine()) != null)
{
Matcher matcher = identifierPattern.matcher(line);
if (matcher.find())
{
endpoint = matcher.group(1);
break;
}
}
}
catch (Exception e)
{
throw new ConfigurationException("CloudstackSnitch cannot access lease file.");
}
if (endpoint == null)
{
throw new ConfigurationException("No metadata server could be found in lease file.");
}
return "http://" + endpoint;
}
}
View on GitHub (pinned to 88fd0f6a0e)