You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "scwhittle (via GitHub)" <gi...@apache.org> on 2023/02/07 13:47:21 UTC
[GitHub] [beam] scwhittle commented on a diff in pull request #25186: Ensure that the BeamFnLoggingClient terminates process if stream breaks
scwhittle commented on code in PR #25186:
URL: https://github.com/apache/beam/pull/25186#discussion_r1098681684
##########
sdks/java/harness/src/main/java/org/apache/beam/fn/harness/logging/BeamFnLoggingClient.java:
##########
@@ -287,9 +284,24 @@ public void run() {
outboundObserver.onError(
Status.INTERNAL.withDescription(getStackTraceAsString(thrown)).asException());
throw new IllegalStateException(thrown);
- } else {
- outboundObserver.onCompleted();
}
+ if (inboundObserverCompletion.isDone()) {
+ try {
+ inboundObserverCompletion.get();
+ throw new IllegalStateException(
+ "Logging stream terminated unexpectedly with success before it was closed by the client.");
+ } catch (ExecutionException e) {
+ throw new IllegalStateException(
+ "Logging stream terminated unexpectedly before it was closed by the client with error: "
+ + e.getCause());
+ } catch (InterruptedException e) {
+ // Should never happen because of the isDone check.
+ Thread.currentThread().interrupt();
+ throw new RuntimeException(e);
+ }
+ }
+
+ outboundObserver.onCompleted();
Review Comment:
Can you clarify? The only onError is followed by throwing an exception, is there something else I'm missing?
--
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-unsubscribe@beam.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org