ryan-mbuashundip commented on code in PR #35120: URL: https://github.com/apache/beam/pull/35120#discussion_r2140718372
########## sdks/java/harness/src/main/java/org/apache/beam/fn/harness/control/ExecutionStateSampler.java: ########## @@ -357,6 +390,15 @@ private void takeSample(long currentTimeMillis, long millisSinceLastSample) { transitionsAtLastSample = transitionsAtThisSample; } else { long lullTimeMs = currentTimeMillis - lastTransitionTimeMillis.get(); + + if (userAllowedTimeoutForRestart && lullTimeMs > userAllowedLullTimeMsForRestart) { + throw new RuntimeException( Review Comment: Prefer to use `DURATION_FORMATTER` and the wording from the Lull warning logs. You should also include information from the `currentExecutionState` (`ptransformId`, `ptransformName`, `stateName`). ```suggestion String timeoutMessage = ""; if (thread == null) { timeoutMessage = String.format( "Operation ongoing in bundle %s for at least %s without outputting " + "or completing (stack trace unable to be generated). The SDK worker will restart.", processBundleId.get(), DURATION_FORMATTER.print(Duration.millis(userAllowedLullTimeMsForRestart).toPeriod())); } else if (currentExecutionState == null) { timeoutMessage = String.format( "Operation ongoing in bundle %s for at least %s without outputting " + "or completing:%n at %s. The SDK worker will restart.", processBundleId.get(), DURATION_FORMATTER.print(Duration.millis(userAllowedLullTimeMsForRestart).toPeriod()), Joiner.on("\n at ").join(thread.getStackTrace())); } else { timeoutMessage = String.format( "Operation ongoing in bundle %s for PTransform{id=%s, name=%s, state=%s} " + "for at least %s without outputting or completing:%n at %s. The SDK worker will restart.", processBundleId.get(), currentExecutionState.ptransformId, currentExecutionState.ptransformUniqueName, currentExecutionState.stateName, DURATION_FORMATTER.print(Duration.millis(userAllowedLullTimeMsForRestart).toPeriod()), Joiner.on("\n at ").join(thread.getStackTrace())); } throw new RuntimeException(timeoutMessage); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org