apache/cassandra · error · RuntimeException
You can not store Async-Profiler results into a data…
Error message
You can not store Async-Profiler results into a data directory of Cassandra.
What it means
maybeCreateProfilesLogDir also rejects placing the Async-Profiler log directory under any Cassandra data file location (data dirs from StorageService.getAllDataFileLocations). Profiler results inside a data directory would pollute SSTable storage and can interfere with operations like snapshots or cleanup, so a RuntimeException is thrown.
Solutions
- Choose a profiler log directory outside all data_file_directories entries
- Keep profiling output on a separate filesystem/mount from data and commitlog
- Audit the resolved absolute path prefix against getAllDataFileLocations before configuring
Example fix
// before async_profiler_dir: /var/lib/cassandra/data/prof // after async_profiler_dir: /var/log/cassandra/async-profiler
Defensive patterns
Strategy: validation
Validate before calling
String dir = Path.of(profilerLogDir).toAbsolutePath().toString();
boolean inDataDir = StorageService.instance.getAllDataFileLocations().stream().anyMatch(dir::startsWith);
if (inDataDir) throw new IllegalArgumentException("profiler log dir must not be inside a data directory"); Try / catch
try { svc.apply(cmd, file); } catch (RuntimeException e) { if (e.getMessage().contains("data directory of Cassandra")) { log.error("move profiler log dir out of data_file_directories"); throw e; } throw e; } Prevention
- Keep profiler output off data_file_directories mounts
- Use absolute, dedicated paths (e.g. /var/log/cassandra/async-profiler)
- Check path prefixes against getAllDataFileLocations during provisioning
When it happens
Trigger: Configuring the profiler log dir at or beneath a data_file_directories entry and then triggering instance(), apply(), list(), fetch(), or purge().
Common situations: Single-volume setups where everything lives under /var/lib/cassandra/data; operators assuming any Cassandra-owned directory is acceptable; automated provisioning that reuses the data dir for logs.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- You can not store Async-Profiler results into system…
- commitlog_disk_access_mode can not be set to direct when…
- Dictionary file does not exist.
- Dictionary file is not readable.
- is missing and cassandra.storagedir system property is not…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/be90f47167007e26.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/AsyncProfilerService.java:439
}
private static void maybeCreateProfilesLogDir()
{
String dir = new File(logDir).toAbsolute().toString();
if ((DatabaseDescriptor.getCommitLogLocation() != null && dir.startsWith(DatabaseDescriptor.getCommitLogLocation())) ||
(DatabaseDescriptor.getAccordJournalDirectory() != null && dir.startsWith(DatabaseDescriptor.getAccordJournalDirectory())) ||
dir.startsWith(DatabaseDescriptor.getHintsDirectory().absolutePath()) ||
(DatabaseDescriptor.getCDCLogLocation() != null && dir.startsWith(DatabaseDescriptor.getCDCLogLocation())) ||
(DatabaseDescriptor.getSavedCachesLocation() != null && dir.startsWith(DatabaseDescriptor.getSavedCachesLocation())))
{
throw new RuntimeException("You can not store Async-Profiler results into system Cassandra directory.");
}
for (String location : StorageService.instance.getAllDataFileLocations())
{
if (dir.startsWith(location))
throw new RuntimeException("You can not store Async-Profiler results into a data directory of Cassandra.");
}
try
{
new File(logDir).createDirectoriesIfNotExists();
}
catch (Throwable t)
{
throw new RuntimeException("Unable to create directory " + logDir);
}
}
private void validateStartParameters(Map<String, String> parameters)
{
if (!ASYNC_PROFILER_START_PARAMS.equals(parameters.keySet()))
{
throw new IllegalArgumentException("Wrong parameters passed to start async profiler method. Passed parameters" +
" should be: " + ASYNC_PROFILER_START_PARAMS);View on GitHub (pinned to 88fd0f6a0e)