You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
channelz: ServerData calls_failed counter not incremented upon client cancellation #13063
// ServerData is data for a specific Server.messageServerData {
...
// The number of incoming calls started on the serverint64calls_started=2;
// The number of incoming calls that have completed with an OK statusint64calls_succeeded=3;
// The number of incoming calls that have a completed with a non-OK statusint64calls_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.
}
changed the title [-]Channelz: ServerData `calls_failed` counter not incremented upon client cancellation[/-][+]channelz: ServerData `calls_failed` counter not incremented upon client cancellation[/+]on Sep 17, 2026
Activity
[-]Channelz: ServerData `calls_failed` counter not incremented upon client cancellation[/-][+]channelz: ServerData `calls_failed` counter not incremented upon client cancellation[/+]stdcout42 commentedon Sep 27, 2026
Hi @jdcormie, is this open for an external contribution? I'd like to take it, starting from the failing test.
jdcormie commentedon Sep 30, 2026
sure go for it
ykisana commentedon Oct 6, 2026
@stdcout42 any updates? I can take this on if you haven't been able to look at it.
stdcout42 commentedon Oct 6, 2026
Go ahead, I won't have time for this in the coming week. Thanks for checking!
core: Count cancelled server calls as failed in channelz
core: Count cancelled server calls as failed in channelz
core: Count cancelled server calls as failed in channelz