java.lang.IllegalStateException: call is closed

2,720 views
Skip to first unread message

Ming Zhao(赵明)

unread,
Nov 20, 2015, 1:37:54 PM11/20/15
to grpc-io, Ilina Mitra
We got this exception when sending a response on a closed rpc, but I
assume this should be taken by the GRPC channel layer instead of
throwing a runtime exception, did I miss anything?

Exception in thread "pool-1-thread-1" java.lang.IllegalStateException:
call is closed
at com.google.common.base.Preconditions.checkState(Preconditions.java:174)Nov
20, 2015 6:28:41 PM com.luminate.acs.client.CpeTask$Tr069Client
setParameterValues
INFO: Sending SetParameterValues response ...

at io.grpc.internal.ServerImpl$ServerCallImpl.sendMessage(ServerImpl.java:492)
at io.grpc.stub.ServerCalls$ResponseObserver.onNext(ServerCalls.java:241)
at com.luminate.acs.config.AcsRequest.sendResponse(AcsRequest.java:113)
at com.luminate.acs.server.ConfigChannelTask.processCommitRequest(ConfigChannelTask.java:190)
at com.luminate.acs.server.ConfigChannelTask.processClientRequest(ConfigChannelTask.java:78)
at com.luminate.acs.server.RegularConfigTask.configure(RegularConfigTask.java:47)
at com.luminate.acs.server.ApConfigTask.run(ApConfigTask.java:68)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

Eric Anderson

unread,
Nov 20, 2015, 1:59:22 PM11/20/15
to Ming Zhao(赵明), grpc-io, Ilina Mitra
After close(Status, Metadata) is called, sending messages doesn't make sense. How did you application end up causing this, and what would you expect to happen?


--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+unsubscribe@googlegroups.com.
To post to this group, send email to grp...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/CAN7VozwyozyDkbx9kHAd91chU8ufu87YWjfkmpaNzd9WXA2E_w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Ming Zhao(赵明)

unread,
Nov 20, 2015, 2:37:04 PM11/20/15
to Eric Anderson, grpc-io, Ilina Mitra
That's a good point, we should check our code to make sure we don't
call onNext() after calling close(), I just want to sure grpc layer
won't call close() implicitly, for example, when the peer cancels the
RPC.
>> email to grpc-io+u...@googlegroups.com.

Eric Anderson

unread,
Nov 20, 2015, 2:55:23 PM11/20/15
to Ming Zhao(赵明), grpc-io, Ilina Mitra
On Fri, Nov 20, 2015 at 11:37 AM, Ming Zhao(赵明) <mz...@luminatewireless.com> wrote:
I just want to sure grpc layer
won't call close() implicitly, for example, when the peer cancels the
RPC.

We use an internal close() that doesn't change the "application called cancel" boolean, so that layer wouldn't throw an exception.

However, on the server with the async stub things aren't quite as simple since there isn't a good way to notify the server when the call is cancelled. So onNext() will throw a StatusRuntimeException on the server if the call becomes cancelled.
Reply all
Reply to author
Forward
0 new messages