boostorg / boostorg/process

wait_for always waits for the full duration, except when under strace/gdb

Open
#69 23 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
145
Forks
151
PR merge metrics
No merged PRs in 30d

Description

System: Debian sid, x86_64

Since 09381034276ce76eedd6936ae330159dec9938d9, the following program:

```
#include
#include
#include

#include

int main() {
std::vector args{"/bin/echo", "hello from child"};

boost::process::ipstream out;

auto begin = std::chrono::high_resolution_clock::now();
bool timeout_flag = false;

boost::process::child child(args);
std::error_code ec;
if (!child.wait_for(std::chrono::seconds{10}, ec)) {
timeout_flag = true;
child.terminate(ec);
}

std::cout << "after wait_for" << std::endl;
}
```

ends up taking 10 seconds to complete, even though the spawned process exits pretty much immediately... except when running under `strace` or `gdb`. When I attach `gdb` to an already running process, I can see that it is blocking in `sigtimedwait`.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.