gRPCClient.jl icon indicating copy to clipboard operation
gRPCClient.jl copied to clipboard

ERROR Channel is closed when streaming server close as expected

Open xgdgsc opened this issue 3 months ago • 4 comments

when using grpc_async_await(req) in streaming client.

ERROR Channel is closed is thrown when streaming server close as expected like

ERROR: LoadError: InvalidStateException: Channel is closed.
Stacktrace:
 [1] grpc_async_await(req::gRPCRequest)
   @ gRPCClient ~/.julia/packages/gRPCClient/WDUmV/src/gRPC.jl:153
 [2] top-level scope
   @ ~/doc/Timberjack/scripts/runRtPrice.jl:23
 [3] include(mod::Module, _path::String)
   @ Base ./Base.jl:306
 [4] exec_options(opts::Base.JLOptions)
   @ Base ./client.jl:317
 [5] _start()
   @ Base ./client.jl:550
in expression starting at /home/user1/doc/Timberjack/scripts/runRtPrice.jl:23

Should exit normally without throwing the error.

EDIT: don' t use grpc_async_await(req) is fine.

xgdgsc avatar Dec 30 '25 07:12 xgdgsc

Yes, we should not be raising this exception here. Working on a fix now.

csvance avatar Dec 30 '25 14:12 csvance

@xgdgsc is this happening with response or bidirectional RPC? Trying to narrow down exactly where the exception is not being handled properly. From first glance it appears all uses of streaming channels will properly handle InvalidStateException. We use a channel as a semaphore to reduce allocations, but that shouldn't be closed unless close(::gRPCCURL) is called somewhere.

Do you get any other error messages printed out?

csvance avatar Dec 30 '25 14:12 csvance

No. I don' t use bidirectional, just one direction streaming RPC.

xgdgsc avatar Dec 31 '25 01:12 xgdgsc

Are there any @error logged besides the exception?

csvance avatar Dec 31 '25 02:12 csvance