Skip to content

Commit b6fc13c

Browse files
committed
Potential fixes
Signed-off-by: Michael Acar <michael.j.acar@gmail.com>
1 parent d85e0ad commit b6fc13c

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/ray/raylet/worker_pool_test.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,17 @@ class WorkerPoolMock : public WorkerPool {
169169
using WorkerPool::PopWorkerCallbackInternal;
170170

171171
// Mock `PopWorkerCallbackAsync` to synchronized function.
172-
void PopWorkerCallbackAsync(PopWorkerCallback callback,
173-
std::shared_ptr<WorkerInterface> worker,
174-
PopWorkerStatus status = PopWorkerStatus::OK) override {
175-
PopWorkerCallbackInternal(callback, worker, status);
172+
void PopWorkerCallbackAsync(
173+
PopWorkerCallback callback,
174+
std::shared_ptr<WorkerInterface> worker,
175+
PopWorkerStatus status,
176+
const std::string &runtime_env_setup_error_message = "") override {
177+
PopWorkerCallbackInternal(callback, worker, status, runtime_env_setup_error_message);
176178
}
177179

178180
Process StartProcess(const std::vector<std::string> &worker_command_args,
179-
const ProcessEnvironment &env) override {
181+
const ProcessEnvironment &env,
182+
std::error_code &ec) override {
180183
// Use a bogus process ID that won't conflict with those in the system
181184
auto pid = static_cast<pid_t>(PID_MAX_LIMIT + 1 + worker_commands_by_proc_.size());
182185
last_worker_process_ = Process::FromPid(pid);

src/ray/util/process.cc

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,9 @@ void SetFdCloseOnExec(int fd) {
8686
static inline ssize_t ReadBytesFromFd(int fd, void *buffer, size_t count) {
8787
ssize_t total_bytes_read = 0;
8888
while (total_bytes_read < (ssize_t)count) {
89-
ssize_t bytes_read =
90-
read(fd, (char *)buffer + total_bytes_read, count - total_bytes_read);
89+
ssize_t bytes_read = read(fd,
90+
reinterpret_cast<char *>(buffer) + total_bytes_read,
91+
count - total_bytes_read);
9192
if (bytes_read == 0) {
9293
// EOF reached before all bytes were read.
9394
return total_bytes_read;
@@ -231,11 +232,9 @@ class ProcessFD {
231232
}
232233
}
233234

234-
if (!decouple) {
235-
// This is the simple case for non-decoupled processes.
236-
// Use a pipe with FD_CLOEXEC to synchronously report execvpe status.
237-
SetFdCloseOnExec(pipefds[1]);
238-
}
235+
// Set the write-end of the pipe to close on exec. This is crucial for the parent
236+
// to detect a successful execve, as the pipe will close automatically.
237+
SetFdCloseOnExec(pipefds[1]);
239238

240239
pid = fork();
241240

0 commit comments

Comments
 (0)