{"record":{"id":"7301080e20cd6a07","repo":"apache/beam","slug":"heap-dump-of-mb-detected-attempting-to-upload-file-to","errorCode":null,"errorMessage":"Heap dump {} of {}MB detected, attempting to upload file to {}","messagePattern":"Heap dump (.+?) of (.+?)MB detected, attempting to upload file to (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java","lineNumber":343,"sourceCode":"  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);\n        }\n\n        try {\n          Files.delete(localSource.toPath());\n          LOG.info(\"Deleted local heap dump {}\", localSource);\n        } catch (IOException e) {\n          LOG.warn(\"Unable to delete local heap dump {}\", localSource, e);","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java#L325-L361","documentation":"An informational warning emitted when MemoryMonitor finds a local heap dump of the given size (in MB) and is about to upload it to the computed remote destination (uploadFilePath/heap_dump<uuid>.hprof, optionally .gz). It signals the start of the upload via FileSystems; failures during the upload are logged separately.","triggerScenarios":"tryUploadHeapDumpIfItExists finds the local heap dump file exists and uploadFilePath != null; it logs size (localSource.length()/1024/1024) and the UUID-suffixed remote destination before calling uploadFile.","commonSituations":"Normal part of heap-dump handling on OOM in Beam workers when an upload directory is configured; seeing it means a dump was captured and upload is in progress.","solutions":["No action needed; this logs an in-progress upload. Check subsequent log lines for 'Heap dump ... uploaded to' or 'Error uploading heap dump' for the outcome.","If uploads repeatedly fail afterwards, verify the FileSystems scheme of the upload path is registered (e.g. gcs-connector on classpath) and credentials are valid."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// upload failures are caught inside MemoryMonitor; check outcome via logs\nboolean ok = monitor.tryUploadHeapDumpIfItExists();\nif (!ok) LOG.warn(\"heap dump not uploaded; inspect worker logs for 'Error uploading heap dump'\");","preventionTips":["Verify the upload path scheme's filesystem is registered and credentials are valid before OOMs occur","Ensure the worker disk can hold the dump until upload completes"],"tags":["java","apache-beam","heap-dump","upload"],"backgroundTag":"file-upload-in-progress","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"}