channelz: ServerData `calls_failed` counter not incremented upon client cancellation
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 88/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- java
- Domain
- observability
Research direction
Start with ServerCallImplTest.java and the callTracer_clientCancelled_reportsCallFailed test, then trace ServerStreamListenerImpl.closed(Status.CANCELLED) through the serverCallTracer updates. The change is done when a client-cancelled call leaves callsStarted at 1, callsSucceeded at 0, and callsFailed at 1 in the test.
Written by the indexing model from the issue text.
Description
What version of gRPC are you using?
HEAD
What did you expect to see?
Per grpc/channelz/v1/channelz.proto (ServerData):
// ServerData is data for a specific Server.
message ServerData {
...
// The number of incoming calls started on the server
int64 calls_started = 2;
// The number of incoming calls that have completed with an OK status
int64 calls_succeeded = 3;
// The number of incoming calls that have a completed with a non-OK status
int64 calls_failed = 4;
...
When an incoming RPC terminates due to client cancellation, transport reset, or client-side deadline expiration, the call terminates with non-OK status (Status.CANCELLED). I expect this situation to be reflected in calls_failed.
What did you see instead?
calls_started increments when the call arrives at the server. However, when a call is cancelled by the client before the server application closes, neither calls_succeeded nor calls_failed is incremented.
Client cancellations or timeouts are not unusual. So on any long-lived server, calls_started - calls_succeeded - calls_failed grows larger and larger over time.
Steps to reproduce
For ServerCallImplTest.java
@Test
public void callTracer_clientCancelled_reportsCallFailed() {
ServerStreamListenerImpl<Long> streamListener =
new ServerCallImpl.ServerStreamListenerImpl<>(call, callListener, context);
streamListener.closed(Status.CANCELLED);
ServerStats.Builder afterBuilder = new ServerStats.Builder();
serverCallTracer.updateBuilder(afterBuilder);
ServerStats after = afterBuilder.build();
assertEquals(1, after.callsStarted);
assertEquals(0, after.callsSucceeded);
assertEquals(1, after.callsFailed); // <--- Fails. Actual value is 0.
}
- Dominant language
- Java
- Stars
- 12.1k
- Forks
- 4k
- Avg merge
- 2d 8h
- Merged PRs (30d)
- 32
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from grpc/grpc-java
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
docs enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 3/5 1-2 days Newbie friendliness 76/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
xDS: identity cert never refreshes when the CA root provider is a separate `file_watcher` instance Openbug
Difficulty 4/5 3-5 days Newbie friendliness 68/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100