{"record":{"id":"cc2aea769130cb33","repo":"apache/beam","slug":"heap-dumps-are-requested-with-enableheapdumps-but-neither","errorCode":null,"errorMessage":"Heap dumps are requested with --enableHeapDumps but neither --remoteHeapDumpLocation nor --tempLocation was provided to specify where to copy captured heap dumps to.","messagePattern":"Heap dumps are requested with --enableHeapDumps but neither --remoteHeapDumpLocation nor --tempLocation was provided to specify where to copy captured heap dumps to\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java","lineNumber":214,"sourceCode":"   */\n  @VisibleForTesting final @Nullable String uploadFilePath;\n\n  @VisibleForTesting final File localDumpFolder;\n\n  @VisibleForTesting final boolean gzipCompress;\n\n  public static MemoryMonitor fromOptions(PipelineOptions options) {\n    SdkHarnessOptions sdkHarnessOptions = options.as(SdkHarnessOptions.class);\n    @Nullable String uploadFilePath = sdkHarnessOptions.getRemoteHeapDumpLocation();\n    if (uploadFilePath == null) {\n      uploadFilePath = options.getTempLocation();\n    }\n    PortablePipelineOptions portableOptions = options.as(PortablePipelineOptions.class);\n    boolean canDumpHeap = false;\n    File localDumpFolder = getHeapDumpDir();\n    if (portableOptions.getEnableHeapDumps()) {\n      if (uploadFilePath == null) {\n        LOG.warn(\n            \"Heap dumps are requested with --enableHeapDumps but neither --remoteHeapDumpLocation nor \"\n                + \"--tempLocation was provided to specify where to copy captured heap dumps to.\");\n      } else {\n        try {\n          Files.createDirectories(localDumpFolder.toPath());\n          canDumpHeap = true;\n        } catch (Exception e) {\n          LOG.warn(\n              \"Encountered exception creating directory for heap dumps, disabling heap dumping.\",\n              e);\n        }\n      }\n    }\n\n    double gcThrashingPercentagePerPeriod = sdkHarnessOptions.getGCThrashingPercentagePerPeriod();\n    return new MemoryMonitor(\n        new SystemGCStatsProvider(),\n        DEFAULT_SLEEP_TIME_MILLIS,","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java#L196-L232","documentation":"MemoryMonitor.fromOptions() enables heap dump capture only when it knows where to put them; if --enableHeapDumps is set but no --remoteHeapDumpLocation or --tempLocation is configured, heap dumps cannot be uploaded and this warning is logged while heap dumping stays disabled (canDumpHeap remains false).","triggerScenarios":"PortablePipelineOptions.setEnableHeapDumps(true) is passed to the SDK harness without setting remoteHeapDumpLocation or a tempLocation from which an upload path can be derived.","commonSituations":"Users enabling heap dumps for OOM debugging on Dataflow/Flink/Spark runners but forgetting --tempLocation; configs migrated between runners where tempLocation semantics differ; CLI flags set programmatically with incomplete options.","solutions":["Set --tempLocation (e.g. gs://bucket/temp) when enabling --enableHeapDumps.","Or set --remoteHeapDumpLocation to an explicit upload path.","Verify via pipeline options that portableOptions.getTempLocation() is non-null at launch.","Use jmap/kubectl cp to capture heap dumps manually if cloud temp storage is unavailable."],"exampleFix":"// before\n--enableHeapDumps=true\n// after\n--enableHeapDumps=true --tempLocation=gs://my-bucket/temp","handlingStrategy":"validation","validationCode":"// Check options before enabling heap dumps\nPortablePipelineOptions p = options.as(PortablePipelineOptions.class);\nif (p.getEnableHeapDumps() && p.getTempLocation() == null && p.getRemoteHeapDumpLocation() == null) {\n  throw new IllegalArgumentException(\"--enableHeapDumps requires --tempLocation or --remoteHeapDumpLocation\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pair --enableHeapDumps with --tempLocation or --remoteHeapDumpLocation","Validate pipeline options at job submission time","Document required flags in your launch templates","Capture dumps manually when no cloud temp location is available"],"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"}