Skip to content

Commit 0783d7d

Browse files
committed
Fix incorrect usage of grpc API
Signed-off-by: joshlee <joshlee@anyscale.com>
1 parent 275a585 commit 0783d7d

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ray/ray_syncer/ray_syncer_bidi_reactor_base.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,12 @@ class RaySyncerBidiReactorBase : public RaySyncerBidiReactor, public T {
175175
ok,
176176
disconnected = IsDisconnected(),
177177
msg = std::move(receiving_message_)]() mutable {
178-
if (*disconnected) {
179-
return;
180-
}
181-
178+
// NOTE: According to the grpc callback streaming api best practices 3.)
179+
// https://grpc.io/docs/languages/cpp/best_practices/#callback-streaming-api
180+
// The client must read all incoming data i.e. until OnReadDone(ok = false)
181+
// happens for OnDone to be called. Hence even if disconnected_ is true, we
182+
// still need to allow OnReadDone to repeatedly execute until StartReadData has
183+
// consumed all the data for OnDone to be called.
182184
if (!ok) {
183185
RAY_LOG_EVERY_MS(INFO, 1000) << "Failed to read a message from node: "
184186
<< NodeID::FromBinary(GetRemoteNodeID());

0 commit comments

Comments
 (0)