How to close underlying TCP connection in client side

99 views
Skip to first unread message

anto oant

unread,
Oct 27, 2023, 2:13:01 PM10/27/23
to grpc.io
I am building a ruby GRPC client and for certain reason, I need to close TCP connection after client being inactive(not sending any request) for 5 minutes, otherwise, new request send through such connection will end up with "
grpc_status:14, grpc_message:"recvmsg:Connection reset by peer" error.

With version 1.43.1 x86_64-linux, I ever used channel_args: { "grpc.client_idle_timeout_ms" => 5 * 1000 } to achieve this, but it seems no longer work with version 1.57.0.

I wonder whether it is intentional or not, if yes, what should I do to achieve my goal in 1.57.0?

any pointer will be really appreciated!

anto oant

unread,
Oct 27, 2023, 2:25:06 PM10/27/23
to grpc.io

by the way, the reason I met this "reset by peer" error is because my server is in AWS cloud (don't know why), I don't have this problem when running server locally.

anto oant

unread,
Oct 27, 2023, 3:25:36 PM10/27/23
to grpc.io
To be more accurate, client_idle_timeout_ms settings sometimes works with grpc version 1.57.0, I tried to use "GRPC_VERBOSITY=debug GRPC_TRACE=client_idle_filter,channel_stack" to print some logs, below is the log when it works, and the last line is missing when it didn't work, seemed like the channel didn't go to idle status correctly.
I1027 11:58:22.187377817 1 channel_stack.cc:116] CHANNEL_STACK: filter client_idle [promise-capable]
I1027 11:58:22.187806892 1 channel_stack.cc:116] CHANNEL_STACK: filter client-channel
D1027 11:58:22.238282078 73 rb_channel.c:732] GRPC_RUBY: run_poll_channels_loop - create connection polling thread
D1027 11:58:22.238531816 73 rb_channel.c:656] GRPC_RUBY: run_poll_channels_loop_no_gil - begin
I1027 11:58:22.348362088 1 channel_stack.cc:114] CHANNEL_STACK: init DynamicFilters
I1027 11:58:22.348391301 1 channel_stack.cc:116] CHANNEL_STACK: filter retry_filter
D1027 11:58:22.371003348 73 tcp_posix.cc:2004] cannot set inq fd=16 errno=92
I1027 11:58:22.819900113 73 channel_stack.cc:114] CHANNEL_STACK: init subchannel
I1027 11:58:22.822087210 73 channel_stack.cc:116] CHANNEL_STACK: filter authority [promise-capable]
I1027 11:58:22.822687281 73 channel_stack.cc:116] CHANNEL_STACK: filter client-auth-filter [promise-capable]
I1027 11:58:22.823268462 73 channel_stack.cc:116] CHANNEL_STACK: filter message_size [promise-capable]
I1027 11:58:22.823767668 73 channel_stack.cc:116] CHANNEL_STACK: filter http-client [promise-capable]
I1027 11:58:22.824236760 73 channel_stack.cc:116] CHANNEL_STACK: filter compression [promise-capable]
I1027 11:58:22.824823023 73 channel_stack.cc:116] CHANNEL_STACK: filter connected [promise-capable]
I1027 11:58:22.900787905 1 channel_idle_filter.cc:247] (client idle filter) timer has started
Reply all
Reply to author
Forward
0 new messages