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

Error logged from client-closed barrage stream #3168

Open
niloc132 opened this issue Dec 8, 2022 · 0 comments
Open

Error logged from client-closed barrage stream #3168

niloc132 opened this issue Dec 8, 2022 · 0 comments

Comments

@niloc132
Copy link
Member

niloc132 commented Dec 8, 2022

This appears to be a race condition where the client has already closed the stream, but the server is still trying to write a message to it.

        at com.google.common.base.Preconditions.checkState(Preconditions.java:502)
        at io.grpc.internal.ServerCallImpl.sendMessageInternal(ServerCallImpl.java:162)
        at io.grpc.internal.ServerCallImpl.sendMessage(ServerCallImpl.java:154)
        at io.grpc.ForwardingServerCall.sendMessage(ForwardingServerCall.java:32)
        at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(ServerCalls.java:380)
        at io.deephaven.server.barrage.BarrageStreamGenerator.processBatches(BarrageStreamGenerator.java:770)
        at io.deephaven.server.barrage.BarrageStreamGenerator$SubView.forEachStream(BarrageStreamGenerator.java:380)
        at io.deephaven.server.arrow.ArrowModule$1.onNext(ArrowModule.java:46)
        at io.deephaven.server.arrow.ArrowModule$1.onNext(ArrowModule.java:41)
        at io.deephaven.server.barrage.BarrageMessageProducer.propagateToSubscribers(BarrageMessageProducer.java:1546)
        at io.deephaven.server.barrage.BarrageMessageProducer.updateSubscriptionsSnapshotAndPropagate(BarrageMessageProducer.java:1456)
        at io.deephaven.server.barrage.BarrageMessageProducer$UpdatePropagationJob.run(BarrageMessageProducer.java:1025)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
        at java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
        at io.deephaven.server.runner.DeephavenApiServerModule$ThreadFactory.lambda$newThread$0(DeephavenApiServerModule.java:164)
        at java.lang.Thread.run(Thread.java:833)

Originally posted by @rcaudy in #3162 (comment)

It might not be appropriate to wrap the entire onNext in a safelyExecuteLocked instead of just a synchronized block, as some errors are expected to escape., though this would let us remove the try/catch in io.deephaven.server.barrage.BarrageMessageProducer#propagateToSubscribers. Instead, we probably would prefer to only handle the case where IO with the grpc stream has failed, close the stream, and not log it, perhaps by wrapping the lambda passed to forEachStream in io.deephaven.server.arrow.ArrowModule#provideListenerAdapter to catch any error that comes from the delegate observer.

Perhaps gRPC anticipates some other pattern to ensure that application code can never write to a closed stream observer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants