Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java task worker does not reconnect to server after unexpected server restart #826

Closed
Snarr opened this issue May 21, 2024 · 0 comments · Fixed by #827
Closed

Java task worker does not reconnect to server after unexpected server restart #826

Snarr opened this issue May 21, 2024 · 0 comments · Fixed by #827
Assignees
Labels
bug Something isn't working sdk-java Java SDK

Comments

@Snarr
Copy link
Member

Snarr commented May 21, 2024

Context

When a Java task worker is connected to a server and the server unexpectedly restarts, the worker recognizes that the gRPC connection closed but fails to reconnect to the server. This makes the worker unusable until the worker itself restarts. In this case I was able to produce the error when running the example-basic workflow example that creates a wfSpec with the same name.

14:02:26 ERROR [LH] PollThread - Unexpected error from server
io.grpc.StatusRuntimeException: CANCELLED: RST_STREAM closed stream. HTTP/2 error code: CANCEL
        at io.grpc.Status.asRuntimeException(Status.java:539) ~[grpc-api-1.56.1.jar:1.56.1]
        at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:491) [grpc-stub-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:567) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:71) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:735) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:716) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) [grpc-core-1.56.1.jar:1.56.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:842) [?:?]
14:02:26 ERROR [LH] PollThread - Unexpected error from server
io.grpc.StatusRuntimeException: CANCELLED: RST_STREAM closed stream. HTTP/2 error code: CANCEL
        at io.grpc.Status.asRuntimeException(Status.java:539) ~[grpc-api-1.56.1.jar:1.56.1]
        at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onClose(ClientCalls.java:491) [grpc-stub-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:567) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl.access$300(ClientCallImpl.java:71) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:735) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:716) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) [grpc-core-1.56.1.jar:1.56.1]
        at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133) [grpc-core-1.56.1.jar:1.56.1]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
        at java.lang.Thread.run(Thread.java:842) [?:?]
<===========--> 87% EXECUTING [16m 30s]
> :example-basic:run

Steps To Reproduce

  1. In a terminal, first launch a LittleHorse server instance

./local-dev/do-server.sh

  1. In a separate terminal, launch a LittleHorse worker instance for example-basic

./gradlew example-basic:run

  1. Kill the LittleHorse server terminal

  2. View the Worker instance terminal and see the error

  3. Relaunch the LittleHorse server

  4. In a separate terminal, use lhctl to launch a wfRun of the example-basic wfSpec

lhctl run example-basic

  1. Notice no update or response from the Worker after the LittleHorse server relaunched

Expected Behavior

The Worker should attempt to reconnect to the server after the connection has closed, establishing a new connection if the server is found and logging that to the terminal.

Screenshots

No response

Additional Context

No response

Components

Java SDK

@Snarr Snarr added the bug Something isn't working label May 21, 2024
@Snarr Snarr self-assigned this May 21, 2024
@coltmcnealy-lh coltmcnealy-lh added the sdk-java Java SDK label May 21, 2024
@Snarr Snarr changed the title Worker does not reconnect to server after unexpected server restart Java task worker does not reconnect to server after unexpected server restart May 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working sdk-java Java SDK
Projects
Status: Done
2 participants