Skip to content

Commit

Permalink
Need to rethink dealing with the defunct process
Browse files Browse the repository at this point in the history
Still not getting the return code from the libged facetize
ged_tessellate call - if I'm following the man pages, it may be because
we have multiple waitpid calls being made that are wiping out the state
by the time we get to the end?  However, if we remove this then
bu_process_id can't recognize the defunct nature of the process and we
end up timing out every time.

Looking at how CMake's CTest manages subprocesses, I'm wondering if it
might make sense to refactor a subset of their code into a more powerful
subprocess management capability for libbu. What CTest does is
essentially what we need to do here - launch multiple processes, monitor
their return status and allow for timeouts.  Looks like they are using a
subset of libuv for some of what they need, so I'm beginning to think
that trying to do this with our own bu_process implementation isn't the
best approach.

Initially I can confine the experiments to facetize itself, but if a
working solution is found it should probably be promoted to a backend
for libbu's process control API in lieu of our current implementation.
  • Loading branch information
starseeker committed Dec 6, 2023
1 parent b7bda3c commit 117e40b
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions src/libbu/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,6 @@ bu_process_pid(struct bu_process *pinfo)
if (!pinfo)
return -1;

// Check if the process is defunct. If so, return -1
#ifdef HAVE_SYS_WAIT_H
int status;
waitpid(pinfo->pid, &status, WNOHANG);
#endif

// Check if the process is still running. If not, return -1
#ifdef HAVE_UNISTD_H
if ((kill(pinfo->pid, 0) == -1) && (errno == ESRCH))
Expand Down

0 comments on commit 117e40b

Please sign in to comment.