{"record":{"id":"61a001f442533864","repo":"juicedata/juicefs","slug":"cancel-token-failed","errorCode":null,"errorMessage":"cancel token failed","messagePattern":"cancel token failed","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"sdk/java/src/main/java/io/juicefs/kerberos/JuiceFSTokenRenewer.java","lineNumber":60,"sourceCode":"  @Override\n  public long renew(Token<?> token, Configuration configuration) throws IOException, InterruptedException {\n    String service = token.getService().toString();\n    FileSystem fs = FileSystem.get(URI.create(service), configuration);\n    if (fs instanceof JuiceFileSystem) {\n      return ((JuiceFileSystemImpl) ((FilterFileSystem) fs).getRawFileSystem()).renewToken(token);\n    }\n    throw new IOException(\"renew token failed\");\n  }\n\n  @Override\n  public void cancel(Token<?> token, Configuration configuration) throws IOException, InterruptedException {\n    String service = token.getService().toString();\n    FileSystem fs = FileSystem.get(URI.create(service), configuration);\n    if (fs instanceof JuiceFileSystem) {\n      ((JuiceFileSystemImpl) ((FilterFileSystem) fs).getRawFileSystem()).cancelToken(token);\n      return;\n    }\n    throw new IOException(\"cancel token failed\");\n  }\n}\n","sourceCodeStart":42,"sourceCodeEnd":63,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/sdk/java/src/main/java/io/juicefs/kerberos/JuiceFSTokenRenewer.java#L42-L63","documentation":"JuiceFSTokenRenewer.cancel throws this IOException when the filesystem for the token's service is not a JuiceFileSystem, so the token cannot be cancelled by this renewer. Mirrors the renew() check for token cancellation.","triggerScenarios":"Token cancellation (testToken path) with a token whose service URI resolves to a non-JuiceFS FileSystem, or where the returned instance is not a FilterFileSystem wrapping JuiceFileSystemImpl.","commonSituations":"Job cleanup cancelling delegated tokens from multiple filesystems; mismatched fs.juicefs.impl config between client and job submission node; stale tokens from a filesystem no longer configured.","solutions":["Confirm the token's service URI points at a JuiceFS filesystem with correct fs.juicefs.impl configuration","Only route JuiceFS-issued tokens to this renewer","Check core-site.xml consistency on the node performing cancellation","Filter tokens by filesystem type before calling cancel"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"FileSystem fs = FileSystem.get(URI.create(token.getService().toString()), conf);\nboolean canCancel = fs instanceof JuiceFileSystem;","typeGuard":"boolean isCancellableJuiceFsToken(Token<?> t, Configuration c) {\n  try { return FileSystem.get(URI.create(t.getService().toString()), c) instanceof JuiceFileSystem; }\n  catch (Exception e) { return false; }\n}","tryCatchPattern":"try {\n  renewer.cancel(token, conf);\n} catch (IOException e) {\n  if (\"cancel token failed\".equals(e.getMessage())) {\n    LOG.warn(\"Skipping cancel for non-JuiceFS token\", e);\n  } else throw e;\n}","preventionTips":["Filter delegated tokens by filesystem kind before cancelling","Align token renewer names with filesystem type","Verify configs on the node that performs job cleanup"],"tags":["hadoop","kerberos","token","filesystem"],"backgroundTag":"unsupported-operation","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}