{"record":{"id":"be90f47167007e26","repo":"apache/cassandra","slug":"you-can-not-store-async-profiler-results-into-a-da","errorCode":null,"errorMessage":"You can not store Async-Profiler results into a data directory of Cassandra.","messagePattern":"You can not store Async-Profiler results into a data directory of Cassandra\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/AsyncProfilerService.java","lineNumber":439,"sourceCode":"    }\n\n    private static void maybeCreateProfilesLogDir()\n    {\n        String dir = new File(logDir).toAbsolute().toString();\n\n        if ((DatabaseDescriptor.getCommitLogLocation() != null && dir.startsWith(DatabaseDescriptor.getCommitLogLocation())) ||\n            (DatabaseDescriptor.getAccordJournalDirectory() != null && dir.startsWith(DatabaseDescriptor.getAccordJournalDirectory())) ||\n            dir.startsWith(DatabaseDescriptor.getHintsDirectory().absolutePath()) ||\n            (DatabaseDescriptor.getCDCLogLocation() != null && dir.startsWith(DatabaseDescriptor.getCDCLogLocation())) ||\n            (DatabaseDescriptor.getSavedCachesLocation() != null && dir.startsWith(DatabaseDescriptor.getSavedCachesLocation())))\n        {\n            throw new RuntimeException(\"You can not store Async-Profiler results into system Cassandra directory.\");\n        }\n\n        for (String location : StorageService.instance.getAllDataFileLocations())\n        {\n            if (dir.startsWith(location))\n                throw new RuntimeException(\"You can not store Async-Profiler results into a data directory of Cassandra.\");\n        }\n\n        try\n        {\n            new File(logDir).createDirectoriesIfNotExists();\n        }\n        catch (Throwable t)\n        {\n            throw new RuntimeException(\"Unable to create directory \" + logDir);\n        }\n    }\n\n    private void validateStartParameters(Map<String, String> parameters)\n    {\n        if (!ASYNC_PROFILER_START_PARAMS.equals(parameters.keySet()))\n        {\n            throw new IllegalArgumentException(\"Wrong parameters passed to start async profiler method. Passed parameters\" +\n                                               \" should be: \" + ASYNC_PROFILER_START_PARAMS);","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/AsyncProfilerService.java#L421-L457","documentation":"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.","triggerScenarios":"Configuring the profiler log dir at or beneath a data_file_directories entry and then triggering instance(), apply(), list(), fetch(), or purge().","commonSituations":"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.","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"],"exampleFix":"// before\nasync_profiler_dir: /var/lib/cassandra/data/prof\n// after\nasync_profiler_dir: /var/log/cassandra/async-profiler","handlingStrategy":"validation","validationCode":"String dir = Path.of(profilerLogDir).toAbsolutePath().toString();\nboolean inDataDir = StorageService.instance.getAllDataFileLocations().stream().anyMatch(dir::startsWith);\nif (inDataDir) throw new IllegalArgumentException(\"profiler log dir must not be inside a data directory\");","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["configuration","filesystem","data-safety"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}