Skip to content

Commit f044eef

Browse files
authored
[Runtime][Disco] Restore checks for hangup of disco pipe (#16997)
This resolves a conflict between two recent changes. In #16989, reads of size zero are used to identify hangups in `ProcessSession`. In #16992, reads of size zero are treated as an error to avoid infinite loops while waiting for data to be ready. For a long-term resolution, the `dmlc::Stream` interface will need to be updated, so that the `Write` method returns the number of bytes written, just as the `Read` method currently does. This will allow the calling scope to verify the number of bytes received.
1 parent b49468d commit f044eef

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/support/pipe.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ class Pipe : public dmlc::Stream {
9292
RetryCallOnEINTR([&]() { return read(handle_, ptr, size); }, GetLastErrorCode);
9393
ICHECK_NE(nread_chunk, -1) << "Write Error: " << strerror(errno);
9494

95-
ICHECK_GT(nread_chunk, 0) << "Was unable to read any data from pipe";
95+
if (nread_chunk == 0) {
96+
break;
97+
}
98+
99+
ICHECK_GE(nread_chunk, 0);
96100
ICHECK_LE(nread_chunk, size) << "Read " << nread_chunk << " bytes, "
97101
<< "but only expected to read " << size << " bytes";
98102
size -= nread_chunk;

0 commit comments

Comments
 (0)