apache/beam · warning

Operation ongoing in bundle

Error message

Operation ongoing in bundle {} for at least {} without outputting or completing:
  at {}

What it means

The SDK harness's ExecutionStateSampler emits this warning when a worker thread has been stuck inside a bundle (a 'lull') for longer than the configured sampling threshold, and no PTransform execution state could be attributed to it, so only the thread's stack trace is reported. It is a diagnostic, not a thrown exception; it indicates a pipeline stage that stopped producing output or completing.

Solutions

  1. Inspect the printed stack trace to find the blocked thread and fix the blocking user code (add timeouts, remove deadlock).
  2. Check the external resource the thread is waiting on (network, database) and fix availability/latency.
  3. Increase the lull threshold if the operation is legitimately long-running (e.g. --sdkHarnessLogInfoThresholdSec).
  4. Split long operations into smaller elements to let bundles complete and output elements.

Example fix

// before
String result = httpClient.execute(request); // no timeout, thread can hang forever
// after
RequestConfig cfg = RequestConfig.custom().setSocketTimeout(30000).build();
CloseableHttpClient client = HttpClients.custom().setDefaultRequestConfig(cfg).build();
Defensive patterns

Strategy: validation

Validate before calling

// Before long-running work inside a DoFn, ensure calls have timeouts
if (timeoutMillis <= 0) { throw new IllegalArgumentException("Blocking call needs a timeout"); }

Prevention

When it happens

Trigger: A DoFn or user code blocks (I/O wait, deadlock, long sleep, unbounded loop) on a worker thread while a bundle is in progress, the sampler's periodic takeSample() observes the same thread and state for more than the lull threshold, and currentExecutionState is null (state not registered with the sampler).

Common situations: User DoFns doing blocking HTTP/DB calls without timeouts; deadlocks between synchronized blocks in user code; external services hanging; too-low --sdkHarnessLogInfoThresholdSec / lull thresholds flagging healthy long-running operations.

Related errors


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

Appendix: source

Thrown at sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java:459

          return Optional.of(timeoutMessage);
        }

        if (lullTimeMs > MAX_LULL_TIME_MS) {
          if (lullTimeMs < lastLullReport // This must be a new report.
              || lullTimeMs > 1.2 * lastLullReport // Exponential backoff.
              || lullTimeMs
                  > MAX_LULL_TIME_MS + lastLullReport // At least once every MAX_LULL_TIME_MS.
          ) {
            lastLullReport = lullTimeMs;
            Thread thread = trackedThread.get();
            if (thread == null) {
              LOG.warn(
                  "Operation ongoing in bundle {} for at least {} without outputting "
                      + "or completing (stack trace unable to be generated).",
                  processBundleId.get(),
                  DURATION_FORMATTER.print(Duration.millis(lullTimeMs).toPeriod()));
            } else if (currentExecutionState == null) {
              LOG.warn(
                  "Operation ongoing in bundle {} for at least {} without outputting "
                      + "or completing:\n  at {}",
                  processBundleId.get(),
                  DURATION_FORMATTER.print(Duration.millis(lullTimeMs).toPeriod()),
                  Joiner.on("\n  at ").join(thread.getStackTrace()));
            } else {
              LOG.warn(
                  "Operation ongoing in bundle {} for PTransform{{id={}, name={}, state={}}} "
                      + "for at least {} without outputting or completing:\n  at {}",
                  processBundleId.get(),
                  currentExecutionState.ptransformId,
                  currentExecutionState.ptransformUniqueName,
                  currentExecutionState.stateName,
                  DURATION_FORMATTER.print(Duration.millis(lullTimeMs).toPeriod()),
                  Joiner.on("\n  at ").join(thread.getStackTrace()));
            }
          }
        }

View on GitHub (pinned to 12126d8942)