restatedev / sdk-java

Restate SDK for JVM Languages
https://restate.dev
MIT License
23 stars 4 forks source link

ProtocolException when closing the stream and invocation finishes concurrently #243

Open slinkydeveloper opened 7 months ago

slinkydeveloper commented 7 months ago

Reported by @StephanEwen, on 0.8

I occasionally see some log noise in java, which seems to be the case when the runtime closes the connection (to suspend) but the invocation just finished concurrently.

dev.restate.sdk.core.ProtocolException: Invocation closed
    at dev.restate.sdk.core.ProtocolException.<clinit>(ProtocolException.java:23) ~[sdk-core-0.8.0.jar:?]
    at dev.restate.sdk.core.InvocationStateMachine.end(InvocationStateMachine.java:218) ~[sdk-core-0.8.0.jar:?]
    at dev.restate.sdk.core.SyscallsImpl.close(SyscallsImpl.java:406) ~[sdk-core-0.8.0.jar:?]
    at dev.restate.sdk.http.vertx.RequestHttpServerHandler.lambda$currentContextExecutor$0(RequestHttpServerHandler.java:177) ~[sdk-http-vertx-0.8.0.jar:?]
    at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:276) ~[vertx-core-4.5.1.jar:4.5.1]
    at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:258) ~[vertx-core-4.5.1.jar:4.5.1]
    at io.vertx.core.impl.ContextInternal.lambda$runOnContext$0(ContextInternal.java:56) ~[vertx-core-4.5.1.jar:4.5.1]
    at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) [netty-transport-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-common-4.1.103.Final.jar:4.1.103.Final]
    at java.lang.Thread.run(Thread.java:833) [?:?]

To be validated. Would be nice to not log an error in that case, is a bit confusing for users.