{"record":{"id":"eb9f8053abb1f56f","repo":"juicedata/juicefs","slug":"rangerpermissionchecker-for-volume-volname-eb9f80","errorCode":null,"errorMessage":"RangerPermissionChecker for volume: \" + volName + \" is already created, but no instance found.","messagePattern":"RangerPermissionChecker for volume: \" \\+ volName \\+ \" is already created, but no instance found\\.","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/permission/RangerPermissionChecker.java","lineNumber":94,"sourceCode":"    rangerPlugin.init();\n  }\n\n  public static RangerPermissionChecker acquire(String volName, long handle, FileSystem superGroupFileSystem, RangerConfig config) throws IOException {\n    synchronized (runningInstance) {\n      if (!runningInstance.containsKey(volName)) {\n        if (pcs.containsKey(volName)) {\n          throw new IOException(\"RangerPermissionChecker for volume: \" + volName + \" is already created, but no running instance found.\");\n        }\n        RangerPermissionChecker pc = new RangerPermissionChecker(superGroupFileSystem, config);\n        pcs.put(volName, pc);\n        Set<Long> handles = new HashSet<>();\n        handles.add(handle);\n        runningInstance.put(volName, handles);\n        return pc;\n      } else {\n        RangerPermissionChecker pc = pcs.get(volName);\n        if (pc == null) {\n          throw new IOException(\"RangerPermissionChecker for volume: \" + volName + \" is already created, but no instance found.\");\n        }\n        runningInstance.get(volName).add(handle);\n        return pc;\n      }\n    }\n  }\n\n  public static void release(String volName, long handle) {\n    if (handle <= 0) {\n      return;\n    }\n    synchronized (runningInstance) {\n      if (!runningInstance.containsKey(volName)) {\n        return;\n      }\n      Set<Long> handles = runningInstance.get(volName);\n      boolean removed = handles.remove(handle);\n      if (!removed) {","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/permission/RangerPermissionChecker.java#L76-L112","documentation":"RangerPermissionChecker.acquire throws this IOException when runningInstance says the volume has live handles but the pcs map has no checker object — an internally inconsistent state (checker should exist whenever a running instance is registered).","triggerScenarios":"Second acquire for a volName present in runningInstance while pcs.get(volName) returns null — e.g. pcs entry was removed externally or not populated concurrently.","commonSituations":"Concurrent modification of the static maps outside acquire/release; partial cleanup from error paths; classloader duplication creating separate pcs/runningInstance views in shared state.","solutions":["Only mutate pcs/runningInstance through acquire()/release()","Check for code paths that call pcs.remove without updating runningInstance","Synchronize all access to the shared static maps","Restart the client to reset static state"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  pc = RangerPermissionChecker.acquire(volName, handle, fs, config);\n} catch (IOException e) {\n  if (e.getMessage().contains(\"is already created, but no instance found\")) {\n    LOG.error(\"Checker maps are inconsistent; restart and audit release() paths\", e);\n  } else throw e;\n}","preventionTips":["Restrict all mutations of pcs/runningInstance to acquire()/release()","Fix code paths that remove from pcs without removing from runningInstance (or vice versa)","Synchronize external reads of the static maps"],"tags":["ranger","permission","lifecycle","state"],"backgroundTag":"internal-invariant-violation","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}