Subject: [Boost-bugs] [Boost C++ Libraries] #13139: child::join() incorrectly throws `waitpid(2) failed: No child processes` if child exited abnormally
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-07-27 19:46:16
#13139: child::join() incorrectly throws `waitpid(2) failed: No child processes` if
child exited abnormally
------------------------------+---------------------
Reporter: keithb@⦠| Owner: (none)
Type: Bugs | Status: new
Milestone: To Be Determined | Component: process
Version: Boost 1.64.0 | Severity: Problem
Keywords: |
------------------------------+---------------------
Create a child process. Let it die abnormally (for example, calling
`kill(getpid(), SIGABRT)` in the child). In the parent, call
`child.join()`.
It appears that the `::waitpid` loop in
`boost::process::detail::posix::wait` at
github.com/boostorg/process/blob/boost-1.64.0/include/boost/process/detail/posix/wait_for_exit.hpp#L26-L31
only checks that the child ended because of a call to `::exit()` and does
not check for exiting via signal (`WIFSIGNALED()`).
Because `WIFSIGNALED()` is true, `WIFEXITED()` is false; and because it's
false, the loop will continue and call `::waitpid()` again... this time
with a child PID to a process which has already been reaped. `waitpid()`
will report an error (indicating that there's no such child prcess), and
the error will be thrown.
The child's exact reason for exiting is lost, which is why I believe this
should be marked a "Showstopper" severity; a workaround would be to avoid
calling `boost::process::wait()` in any fashion and to instead use a
custom waitpid loop using the `child.native_handle()`.
-- Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13139> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-07-27 19:49:22 UTC