{"record":{"id":"771b7d478bfe3a25","repo":"apache/druid","slug":"failed-to-remove-output-directory-s-for-segment-771b7d","errorCode":null,"errorMessage":"Failed to remove output directory [%s] for segment pulled from [%s]","messagePattern":"Failed to remove output directory \\[(.+?)\\] for segment pulled from \\[(.+?)\\]","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java","lineNumber":65,"sourceCode":"    CloudFilesObjectApiProxy objectApi = new CloudFilesObjectApiProxy(cloudFilesApi, region, container);\n    final CloudFilesByteSource byteSource = new CloudFilesByteSource(objectApi, path);\n\n    try {\n      final FileUtils.FileCopyResult result = CompressionUtils.unzip(\n          byteSource,\n          outDir,\n          CloudFilesUtils.CLOUDFILESRETRY,\n          false\n      );\n      log.info(\"Loaded %d bytes from [%s] to [%s]\", result.size(), path, outDir.getAbsolutePath());\n      return result;\n    }\n    catch (Exception e) {\n      try {\n        FileUtils.deleteDirectory(outDir);\n      }\n      catch (IOException ioe) {\n        log.warn(\n            ioe,\n            \"Failed to remove output directory [%s] for segment pulled from [%s]\",\n            outDir.getAbsolutePath(),\n            path\n        );\n      }\n      throw new SegmentLoadingException(e, e.getMessage());\n    }\n    finally {\n      try {\n        byteSource.closeStream();\n      }\n      catch (IOException ioe) {\n        log.warn(ioe, \"Failed to close payload for segmente pulled from [%s]\", path);\n      }\n    }\n  }\n}","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/cloudfiles-extensions/src/main/java/org/apache/druid/storage/cloudfiles/CloudFilesDataSegmentPuller.java#L47-L83","documentation":"CloudFilesDataSegmentPuller.getSegmentFiles() pulls a segment from Rackspace Cloud Files into a temp dir; on pull failure it attempts FileUtils.deleteDirectory(outDir) and logs this warning if that cleanup throws IOException. The real SegmentLoadingException is rethrown to the caller; this warning signals leftover temp directories.","triggerScenarios":"Segment download from Cloud Files fails (auth failure, missing container/object, corrupt archive) and the subsequent temp-dir deletion fails due to open file handles, permissions, or filesystem errors.","commonSituations":"Expired or wrong Rackspace API credentials; container name/region misconfig; segment cache on a shared/NFS filesystem; disk full or read-only mount during cleanup.","solutions":["Resolve the pull failure: verify Cloud Files credentials, container, and region config","Remove leftover temp dirs under the segment cache location manually","Check permissions and mount health (not read-only) for the cache directory","Ensure the filesystem supports reliable recursive delete (avoid NFS if persistent)"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight Cloud Files access\nContainer container = cfClient.getContainer(name); // fails fast on auth/region issues","typeGuard":null,"tryCatchPattern":"try {\n  puller.getSegmentFiles(descriptor);\n} catch (SegmentLoadingException e) {\n  log.warn(e, \"Cloud Files pull failed; leftover temp dir possible\");\n}","preventionTips":["Verify Rackspace username/API key/region configuration","Use reliable local disk for segment caching; avoid NFS","Monitor disk space and mount state (not read-only)","Treat this warning as a signal of an earlier pull failure and investigate root cause"],"tags":["cloudfiles","rackspace","segment-loading","filesystem-cleanup"],"backgroundTag":"file-write-failed","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}