Marton Greber has uploaded this change for review. ( 
http://gerrit.cloudera.org:8080/24905


Change subject: KUDU-3806: add deadline-bounded WaitAndCollect()
......................................................................

KUDU-3806: add deadline-bounded WaitAndCollect()

Add Subprocess::WaitAndCollect(), which concurrently drains the child's
piped stdout and stderr while waiting for it to exit, up to a deadline.
Draining both pipes together means a large write on one cannot deadlock
against a full buffer on the other; if the deadline passes first the
child is killed (SIGKILL), '*timed_out' is set, and whatever output was
collected so far is still returned.

To support this, ReadFdsFully() gains a deadline: a one-shot libev timer
(DeadlineHelper) breaks the drain loop when it fires, and each fd watcher
now decrements a shared open-count so the loop ends deterministically at
EOF even with the timer armed. An uninitialized deadline preserves the
historical "drain to EOF" behavior, which is what Subprocess::Call()
continues to pass.

This is groundwork for running each MCP tools/call in a bounded child
'kudu' process.

Change-Id: I582ea89b0ada4f723695df8d98d7e5bc0bbc7f7f
Co-Authored-By: Claude Opus 4.8 <[email protected]>
---
M src/kudu/util/subprocess-test.cc
M src/kudu/util/subprocess.cc
M src/kudu/util/subprocess.h
3 files changed, 247 insertions(+), 21 deletions(-)



  git pull ssh://gerrit.cloudera.org:29418/kudu refs/changes/05/24905/1
--
To view, visit http://gerrit.cloudera.org:8080/24905
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: kudu
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I582ea89b0ada4f723695df8d98d7e5bc0bbc7f7f
Gerrit-Change-Number: 24905
Gerrit-PatchSet: 1
Gerrit-Owner: Marton Greber <[email protected]>

Reply via email to