{"record":{"id":"78d61eeaa4d8c3ce","repo":"nathanmarz/storm","slug":"could-not-get-canonical-path-for-piddir","errorCode":null,"errorMessage":"Could not get canonical path for ${_pidDir}","messagePattern":"Could not get canonical path for (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"storm-core/src/jvm/backtype/storm/task/WorkerTopologyContext.java","lineNumber":63,"sourceCode":"            String codeDir,\n            String pidDir,\n            Integer workerPort,\n            List<Integer> workerTasks,\n            Map<String, Object> defaultResources,\n            Map<String, Object> userResources\n            ) {\n        super(topology, stormConf, taskToComponent, componentToSortedTasks, componentToStreamToFields, stormId);\n        _codeDir = codeDir;\n        _defaultResources = defaultResources;\n        _userResources = userResources;\n        try {\n            if(pidDir!=null) {\n                _pidDir = new File(pidDir).getCanonicalPath();\n            } else {\n                _pidDir = null;\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(\"Could not get canonical path for \" + _pidDir, e);\n        }\n        _workerPort = workerPort;\n        _workerTasks = workerTasks;\n    }\n\n    /**\n     * Gets all the task ids that are running in this worker process\n     * (including the task for this task).\n     */\n    public List<Integer> getThisWorkerTasks() {\n        return _workerTasks;\n    }\n    \n    public Integer getThisWorkerPort() {\n        return _workerPort;\n    }\n\n    /**","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/task/WorkerTopologyContext.java#L45-L81","documentation":"WorkerTopologyContext's constructor resolves the worker's pid directory to its canonical filesystem path. If File.getCanonicalPath() throws an IOException (e.g. the pidDir path cannot be resolved on disk), it wraps it in a RuntimeException with this message. This is fatal to worker startup because the pid dir is needed for process bookkeeping.","triggerScenarios":"Supervisor/worker passes a pidDir path that does not exist or lies on an unmounted/deleted volume, or filesystem-level I/O errors (permissions on parent dirs, broken symlinks) prevent canonicalization when a worker's topology context is constructed.","commonSituations":"Disk full or the supervisor's local dir (e.g. storm.local.dir) cleaned up underneath a running worker; NFS mounts dropped; pid dir deleted by log-cleanup cron or container restart; mismatched permissions after running as a different user.","solutions":["Verify the pid directory path exists and is accessible: ls -ld <pidDir> and check permissions for the worker user","Check that storm.local.dir / supervisor local dirs are on a mounted, writable filesystem and the volume is not full","Restart the supervisor/worker so a fresh pid dir is created","Inspect the wrapped IOException cause in the stack trace for the underlying OS-level reason","Enable worker logging to see which path failed and fix stale symlinks"],"exampleFix":"// before: passing a possibly-nonexistent dir\nnew WorkerTopologyContext(topology, config, tasks, taskToComponent, componentToSortedTasks, null, pidDir, workerPort, workerTasks);\n// after: ensure dir exists before constructing\nFiles.createDirectories(new File(pidDir).toPath());\nnew WorkerTopologyContext(topology, config, tasks, taskToComponent, componentToSortedTasks, null, pidDir, workerPort, workerTasks);","handlingStrategy":"validation","validationCode":"File dir = new File(pidDir);\nif (!dir.exists() && !dir.mkdirs())\n    throw new IllegalStateException(\"pidDir not creatable: \" + pidDir);\ntry { dir.getCanonicalPath(); } catch (IOException e) { throw new IllegalStateException(\"pidDir not resolvable: \" + pidDir, e); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure storm.local.dir is on a stable, writable mounted volume","Monitor disk usage and avoid external cleanup of supervisor working dirs","Run supervisor and workers as the same OS user","Restart supervisors after volume remounts rather than letting workers reuse stale paths"],"tags":["filesystem","io","worker-startup","storm"],"backgroundTag":"file-read-failed","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}