{"record":{"id":"f636a56a8bff5382","repo":"apache/beam","slug":"heap-dump-detected-but-no-upload-directory-was-provided","errorCode":null,"errorMessage":"Heap dump {} detected but no upload directory was provided.","messagePattern":"Heap dump (.+?) detected but no upload directory was provided\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java","lineNumber":336,"sourceCode":"        if (interrupted) {\n          Thread.currentThread().interrupt();\n        }\n      }\n    }\n  }\n\n  private File getDefaultHeapDumpPath() {\n    return new File(localDumpFolder, \"heap_dump.hprof\");\n  }\n\n  @VisibleForTesting\n  boolean tryUploadHeapDumpIfItExists() {\n    boolean uploadedHeapDump = false;\n    File localSource = getDefaultHeapDumpPath();\n    LOG.info(\"Looking for heap dump at {}\", localSource);\n    if (localSource.exists()) {\n      if (uploadFilePath == null) {\n        LOG.warn(\"Heap dump {} detected but no upload directory was provided.\", localSource);\n      } else {\n        String remoteDest =\n            String.format(\"%s/heap_dump%s.hprof\", uploadFilePath, UUID.randomUUID());\n        if (gzipCompress) {\n          remoteDest = remoteDest + \".gz\";\n        }\n        LOG.warn(\n            \"Heap dump {} of {}MB detected, attempting to upload file to {}\",\n            localSource,\n            localSource.length() / 1024 / 1024,\n            remoteDest);\n        ResourceId resource = FileSystems.matchNewResource(remoteDest, false);\n        try {\n          uploadFile(localSource, resource, gzipCompress);\n          uploadedHeapDump = true;\n          LOG.warn(\"Heap dump {} uploaded to {}\", localSource, remoteDest);\n        } catch (IOException e) {\n          LOG.error(\"Error uploading heap dump to {}\", remoteDest, e);","sourceCodeStart":318,"sourceCodeEnd":354,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java#L318-L354","documentation":"MemoryMonitor detected a heap dump file at the default local path but the uploadFilePath (remote destination directory) was never configured, so the dump cannot be shipped off the runner. The dump stays on local disk and will not be uploaded. This is a configuration-gap warning rather than a thrown exception.","triggerScenarios":"A heap dump was produced (heap dump on OOM enabled / dump triggered) while MemoryMonitor.fromOptions was constructed without the --heapDumpUploadPath (uploadFilePath) option; tryUploadHeapDumpIfItExists then finds localSource.exists() with uploadFilePath == null.","commonSituations":"Users enabling heap dumping in tests or local runs and forgetting to set the upload directory; a runner/template where the upload path option was dropped from pipeline options.","solutions":["Set the heap dump upload path pipeline option (uploadFilePath) to a supported FileSystems destination (e.g. gs://bucket/path).","If off-runner retention is not needed, fetch the dump manually from the local default heap dump path before the worker is torn down.","Alternatively disable heap dumping so no orphan local dumps are produced."],"exampleFix":"// before: no upload dir configured\nPipelineOptions options = PipelineOptionsFactory.create();\n// after: provide upload directory\noptions.as(HarnessOptions.class).setHeapDumpUploadPath(\"gs://my-bucket/heapdumps\");","handlingStrategy":"validation","validationCode":"// before enabling heap dumping, ensure the upload path option is set\nif (options.as(HarnessOptions.class).getHeapDumpUploadPath() == null) {\n  throw new IllegalArgumentException(\"heapDumpUploadPath must be set when heap dumping is enabled\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set heapDumpUploadPath alongside heap-dump options","Use a supported FileSystems scheme (gs://, s3://) with the connector on the classpath","Add the option to your pipeline templates so it is not dropped"],"tags":["java","apache-beam","heap-dump","configuration"],"backgroundTag":"missing-required-config-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}