apache/beam · info

Heap dump of MB detected, attempting to upload file to

Error message

Heap dump {} of {}MB detected, attempting to upload file to {}

What it means

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.

Solutions

  1. 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.
  2. 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.
Defensive patterns

Strategy: try-catch

Try / catch

// upload failures are caught inside MemoryMonitor; check outcome via logs
boolean ok = monitor.tryUploadHeapDumpIfItExists();
if (!ok) LOG.warn("heap dump not uploaded; inspect worker logs for 'Error uploading heap dump'");

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/7301080e20cd6a07. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/harness/src/main/java/org/apache/beam/fn/harness/status/MemoryMonitor.java:343

  private File getDefaultHeapDumpPath() {
    return new File(localDumpFolder, "heap_dump.hprof");
  }

  @VisibleForTesting
  boolean tryUploadHeapDumpIfItExists() {
    boolean uploadedHeapDump = false;
    File localSource = getDefaultHeapDumpPath();
    LOG.info("Looking for heap dump at {}", localSource);
    if (localSource.exists()) {
      if (uploadFilePath == null) {
        LOG.warn("Heap dump {} detected but no upload directory was provided.", localSource);
      } else {
        String remoteDest =
            String.format("%s/heap_dump%s.hprof", uploadFilePath, UUID.randomUUID());
        if (gzipCompress) {
          remoteDest = remoteDest + ".gz";
        }
        LOG.warn(
            "Heap dump {} of {}MB detected, attempting to upload file to {}",
            localSource,
            localSource.length() / 1024 / 1024,
            remoteDest);
        ResourceId resource = FileSystems.matchNewResource(remoteDest, false);
        try {
          uploadFile(localSource, resource, gzipCompress);
          uploadedHeapDump = true;
          LOG.warn("Heap dump {} uploaded to {}", localSource, remoteDest);
        } catch (IOException e) {
          LOG.error("Error uploading heap dump to {}", remoteDest, e);
        }

        try {
          Files.delete(localSource.toPath());
          LOG.info("Deleted local heap dump {}", localSource);
        } catch (IOException e) {
          LOG.warn("Unable to delete local heap dump {}", localSource, e);

View on GitHub (pinned to 12126d8942)