{"record":{"id":"568b7a44b1b508e0","repo":"aeron-io/aeron","slug":"cnc-file-not-created-cncfile-getabsolutepath","errorCode":null,"errorMessage":"CnC file not created: <cncFile.getAbsolutePath()>","messagePattern":"CnC file not created: <cncFile\\.getAbsolutePath\\(\\)>","errorType":"exception","errorClass":"DriverTimeoutException","httpStatus":null,"severity":"error","filePath":"aeron-client/src/main/java/io/aeron/CommonContext.java","lineNumber":1394,"sourceCode":"    }\n\n    static int driverFilePageSize(final DirectBuffer metadata)\n    {\n        final int pageSize = CncFileDescriptor.filePageSize(metadata);\n        return 0 != pageSize ? pageSize : LogBufferDescriptor.PAGE_MIN_SIZE;\n    }\n\n    @SuppressWarnings(\"try\")\n    static UnsafeBuffer awaitCncFileCreation(\n        final File cncFile, final EpochClock clock, final long deadlineMs)\n    {\n        while (true)\n        {\n            while (!cncFile.exists() || cncFile.length() < CncFileDescriptor.META_DATA_LENGTH)\n            {\n                if (clock.time() > deadlineMs)\n                {\n                    throw new DriverTimeoutException(\"CnC file not created: \" + cncFile.getAbsolutePath());\n                }\n\n                sleep(Aeron.Configuration.IDLE_SLEEP_DEFAULT_MS);\n            }\n\n            try (FileChannel fileChannel = FileChannel.open(cncFile.toPath(), READ, WRITE))\n            {\n                final long fileSize = fileChannel.size();\n                if (fileSize < CncFileDescriptor.META_DATA_LENGTH)\n                {\n                    if (clock.time() > deadlineMs)\n                    {\n                        throw new DriverTimeoutException(\n                            \"CnC file is created but not populated: \" + cncFile.getAbsolutePath());\n                    }\n\n                    fileChannel.close();\n                    sleep(Aeron.Configuration.IDLE_SLEEP_DEFAULT_MS);","sourceCodeStart":1376,"sourceCodeEnd":1412,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-client/src/main/java/io/aeron/CommonContext.java#L1376-L1412","documentation":"When awaiting a driver, the client polls for the CnC file to exist and be at least META_DATA_LENGTH bytes. If the file never appears (or stays too small) within the deadline, a DriverTimeoutException naming the expected CnC path is thrown.","triggerScenarios":"Calling Aeron.connect() (or CommonContext.awaitDriver) with useDriverActiveCheck/conductorTickNanos await logic when no media driver is running at cncFile's directory, and the file is not created before the deadline.","commonSituations":"Forgot to start the media driver before connecting the client; driver started in a different aeron.dir than the client; driver failed to start due to permissions on the directory; typo in aeronDirectoryName.","solutions":["Start the Aeron media driver before connecting the client","Verify the client's aeronDirectoryName matches the driver's (aeron.dir)","Check filesystem permissions on the aeron directory so the driver can create cnc.dat","Increase the await deadline (clock-based deadlineMs) if driver startup is slow"],"exampleFix":"// before\nAeron aeron = Aeron.connect(); // no driver running at default dir\n\n// after\nMediaDriver.launch(new MediaDriver.Context().aeronDirectoryName(\"/dev/shm/aeron\"));\nAeron aeron = Aeron.connect(new Aeron.Context().aeronDirectoryName(\"/dev/shm/aeron\"));","handlingStrategy":"retry","validationCode":"File cnc = new File(aeronDir, \"cnc.dat\");\nif (!cnc.exists()) {\n    throw new IllegalStateException(\"No Aeron driver CnC file at \" + cnc.getAbsolutePath() + \" - start the media driver first\");\n}","typeGuard":null,"tryCatchPattern":"try { Aeron aeron = Aeron.connect(ctx); } catch (DriverTimeoutException e) { if (e.getMessage().startsWith(\"CnC file not created\")) { startDriverOrFixDir(); retryConnect(); } else { throw e; } }","preventionTips":["Always launch (or otherwise ensure) the media driver before Aeron.connect()","Confirm client and driver use the same aeronDirectoryName","Check directory permissions so the driver can create cnc.dat"],"tags":["aeron","driver","timeout","cnc-file","file-not-found"],"backgroundTag":"request-timeout","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}