Skip to content

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

@griwes

Description

@griwes

System: Debian sid, x86_64

Since 0938103, the following program:

#include <iostream>
#include <string>
#include <vector>

#include <boost/process.hpp>

int main() {
    std::vector<std::string> 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions