-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error code indicates success when OOM #68
Comments
Digging a bit more I'm wondering why reproc/reproc/src/process.posix.c Lines 463 to 476 in 8c268f3
With reproc/reproc/src/process.posix.c Lines 453 to 456 in 8c268f3
Is it to support stop actions ( Do I need then to filter the status code depending on the stop options I passed (or left empty)? We could also document a bit more this behavior |
I agree we should probably deal better with signals killing processes that aren't sent by reproc. For now, you've understood it correctly, we don't interpret exit statuses so you'd have to do that yourself after the process exits. I'd happily merge a PR that more explicitly states that in the documentation. (We also don't expose a constant for the oom signal yet but that should be easy to implement as well) |
I would like to document a bit the workaround I implemented in #include <reproc/reproc.h>
bool reproc_killed(int status)
{
return status == REPROC_SIGKILL;
}
bool reproc_terminated(int status)
{
return status == REPROC_SIGTERM;
}
void assert_reproc_success(reproc::options options, int status, std::error_code ec)
{
bool killed_not_an_err = (options.stop.first.action == reproc::stop::kill)
|| (options.stop.second.action == reproc::stop::kill)
|| (options.stop.third.action == reproc::stop::kill);
bool terminated_not_an_err = (options.stop.first.action == reproc::stop::terminate)
|| (options.stop.second.action == reproc::stop::terminate)
|| (options.stop.third.action == reproc::stop::terminate);
if (ec || (!killed_not_an_err && reproc_killed(status))
|| (!terminated_not_an_err && reproc_terminated(status)))
{
if (ec)
LOG_ERROR << "Subprocess call failed: " << ec.message();
else if (reproc_killed(status))
LOG_ERROR << "Subprocess call failed (killed)";
else
LOG_ERROR << "Subprocess call failed (terminated)";
throw std::runtime_error("Subprocess call failed. Aborting.");
}
} |
@adriendelsalle Heya, just checking, so recent versions of mamba/micromamba have a mitigation/workaround for this? (My team is still using an old micromamba version for our Docker images and new teammates run into this issue until they bump up their Docker memory resources.) |
Hey @DaanDeMeyer thanks for this project!
Description
I'm running
reproc++
inside a Docker container and I would like to catch OOM errors.When a sub-process get killed by OOM, status is
137
reflecting the fatal error withSIGKILL
(AFAIK https://tldp.org/LDP/abs/html/exitcodes.html) but the error code issystem:0
.I don't really get why the error code doesn't reflect that.
Does the
error_code_from
function called fromprocess::stop
will consider positive status as successful?Thanks!
To reproduce
A minimal example trying to allocate a
numpy
array:The
CMake
lists to build the project:A
Docker
image withnumpy
installed:Image built with tag
reprocoom
:docker build . -t reprocoom
And finally the
Docker
command to reproduce:The text was updated successfully, but these errors were encountered: