Skip to content

Commit 8918aae

Browse files
committed
Document status ordering rules
This documents a rule that's existed in a hard to find internal document that's existed since Feb 2016 by [email protected]. Since that rule is critical to untangling some gRPC C core behavior, we should document it publically.
1 parent 437cc19 commit 8918aae

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

doc/status_ordering.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Ordering Status and Reads in the gRPC API
2+
-----------------------------------------
3+
4+
Rules for implementors:
5+
1. Reads and Writes Must not succeed after Status has been delivered.
6+
2. OK Status is only delivered after all buffered messages are read.
7+
3. Reads May continue to succeed after a failing write.
8+
However, once a write fails, all subsequent writes Must fail,
9+
and similarly, once a read fails, all subsequent reads Must fail.
10+
4. When an error status is known to the library, if the user asks for status,
11+
the library Should discard messages received in the library but not delivered
12+
to the user and then deliver the status. If the user does not ask for status
13+
but continues reading, the library Should deliver buffered messages before
14+
delivering status. The library MAY choose to implement the stricter version
15+
where errors cause all buffered messages to be dropped, but this is not a
16+
requirement.

test/core/end2end/tests/streaming_error_response.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
*
3232
*/
3333

34+
/** \file Verify that status ordering rules are obeyed.
35+
\ref doc/status_ordering.md */
36+
3437
#include "test/core/end2end/end2end_tests.h"
3538

3639
#include <stdio.h>

0 commit comments

Comments
 (0)