grpc / grpc/grpc-java

InternalSubChannel doesn't comply with the connectivity state spec

Open
#2,873 4 comments 0 reactions 1 assignee Claimed by @zhangkun83 View on GitHub
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

When receiving a GOAWAY (`transportShutdown()` callback), `InternalSubChannel` unconditionally [transitions to `IDLE`](https://github.com/grpc/grpc-java/blob/v1.2.0/core/src/main/java/io/grpc/internal/InternalSubchannel.java#L439). However, the [spec](https://github.com/grpc/grpc/blob/v1.2.1/doc/connectivity-semantics-and-api.md) says
1. `READY` transitions to `TRANSIENT_FAILURE` on "any failure encountered while expecting successful communication on established channel."
1. "Channels that receive a GOAWAY when there are no active or pending RPCs should also switch to IDLE".

`InternalSubchannel` needs to look at the status passed to `transportShutdown()`:
- If it's not OK, according to Rule 1 above, the new state should be `TRANSIENT_FAILURE`
- If it's OK, then it's a GOAWAY.
- If the in-use state of the subchannel is `false`, according to Rule 2 above, the new state should be `IDLE`.
- Otherwise, the spec doesn't say what the new state should be. Apparently it cannot stay in `READY`. It cannot go to `TRANSIENT_FAILURE` either because it's a GOAWAY, not an error. This part of the spec should be revisited.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.