Commit ec14b26
committed
Identified some incorrect handlings of end of stream indicator and fixed them:
1. Client-to-Server EOS & Cardinality Decoupling (handleRequestBodyResponse)
The Issue: Previously, the filter tracked application-initiated half-closes using an internal halfClosed atomic boolean. Once set, it assumed the very next ProcessingResponse from the sidecar was the final one and immediately half-closed the upstream RPC, violating gRFC A93’s 1-to-N / M-to-N streaming body specification.
The Fix:
Stateless Half-Close: Completely eliminated halfClosed state tracking; upstream half-closing is now stateless and driven exclusively by sidecar commands.
Explicit A93 Protocol Boundaries: In handleRequestBodyResponse(), proceedWithHalfClose() is triggered strictly when the sidecar sends a ProcessingResponse explicitly marked with end_of_stream = true (piggybacked on a body chunk) or end_of_stream_without_message = true.
Streaming Queue Decoupling: Refined the expectedResponses queue to enforce 1-to-1 synchronous ordering only for headers and trailers, allowing asynchronous streaming body chunks to be exchanged freely without triggering cardinality mismatch errors.
2. Strict proceedWithClose() Lifecycle on Trailers Response
The Issue: handleResponseBodyResponse() previously triggered premature call closure during body processing. Furthermore, there was ambiguity around whether server-to-client body EOS indicators should trigger call completion.
The Fix:
Removed Body-Triggered Closure: Completely removed proceedWithClose() from server-to-client body processing (handleResponseBodyResponse()), ensuring body EOS indicators do not terminate the RPC.
Trailers-Driven Completion: Enforced that client call completion (proceedWithClose()) relies strictly on the receipt of response trailers from the sidecar (hasResponseTrailers()).
Clean Handshake for Skipped Trailers: If response_trailer_mode is set to SKIP (or default), the filter notifies the sidecar that the server stream is finished via an empty body carrying end_of_stream_without_message = true, and immediately invokes proceedWithClose() without waiting for a response.1 parent 59be21b commit ec14b26
2 files changed
Lines changed: 561 additions & 80 deletions
File tree
- xds/src
- main/java/io/grpc/xds
- test/java/io/grpc/xds
Lines changed: 39 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
854 | | - | |
855 | 854 | | |
856 | 855 | | |
857 | 856 | | |
| |||
1067 | 1066 | | |
1068 | 1067 | | |
1069 | 1068 | | |
1070 | | - | |
1071 | 1069 | | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
1075 | 1078 | | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
1079 | 1087 | | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1088 | + | |
1085 | 1089 | | |
1086 | 1090 | | |
1087 | | - | |
| 1091 | + | |
1088 | 1092 | | |
1089 | 1093 | | |
1090 | 1094 | | |
1091 | 1095 | | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1092 | 1110 | | |
1093 | 1111 | | |
1094 | 1112 | | |
| |||
1154 | 1172 | | |
1155 | 1173 | | |
1156 | 1174 | | |
| 1175 | + | |
1157 | 1176 | | |
1158 | 1177 | | |
1159 | 1178 | | |
| |||
1219 | 1238 | | |
1220 | 1239 | | |
1221 | 1240 | | |
1222 | | - | |
1223 | | - | |
1224 | 1241 | | |
1225 | 1242 | | |
1226 | | - | |
1227 | | - | |
1228 | 1243 | | |
1229 | 1244 | | |
1230 | 1245 | | |
| |||
1396 | 1411 | | |
1397 | 1412 | | |
1398 | 1413 | | |
1399 | | - | |
1400 | 1414 | | |
1401 | 1415 | | |
1402 | 1416 | | |
| |||
1443 | 1457 | | |
1444 | 1458 | | |
1445 | 1459 | | |
1446 | | - | |
1447 | | - | |
1448 | | - | |
1449 | | - | |
1450 | | - | |
1451 | | - | |
1452 | | - | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
1453 | 1465 | | |
1454 | 1466 | | |
1455 | 1467 | | |
| |||
1463 | 1475 | | |
1464 | 1476 | | |
1465 | 1477 | | |
1466 | | - | |
1467 | | - | |
1468 | | - | |
1469 | 1478 | | |
1470 | 1479 | | |
1471 | 1480 | | |
| |||
1777 | 1786 | | |
1778 | 1787 | | |
1779 | 1788 | | |
1780 | | - | |
1781 | | - | |
1782 | | - | |
1783 | | - | |
| 1789 | + | |
1784 | 1790 | | |
1785 | 1791 | | |
1786 | 1792 | | |
| |||
0 commit comments