boostorg / boostorg/process

V2 overwrites SIGCHLD handler without calling previous one

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

Description

We're using boost::process in a library to spawn a process. We use RHEL 8, so no pidfd, unfortunately.

This library is used in an executable that spawns its own child processes and thus installs its own SIGCHLD handler.

It seems that in v2, the boost::process / boost::asio signal handler completely overwrites the application signal handler, which leads to havoc, since the main application does not notice its child processes exiting anymore...

Asio docs for `basic_signal_set` say (https://live.boost.org/doc/libs/1_86_0/doc/html/boost_asio/reference/basic_signal_set.html#boost_asio.reference.basic_signal_set.multiple_registration_of_signals):
> The application must not also register a signal handler using functions such as signal() or sigaction().

This makes the use of `basic_signal_set` unacceptable in a library IMO.

In v1, there was some effort, to call the previous signal handler as well: https://github.com/boostorg/process/blob/55e24609671859626caa39c3502fd12df52aee3b/include/boost/process/v1/detail/posix/wait_for_exit.hpp#L68-L69

However, there's also use of asio::signal_set in sigchld_service: https://github.com/boostorg/process/blob/55e24609671859626caa39c3502fd12df52aee3b/include/boost/process/v1/detail/posix/sigchld_service.hpp#L28

In any case, we managed to use v1 for our use-case. But I think it's currently impossible to use boost process v2 for our use case...

Do you agree or am I missing something?

Are there any plans to make v2 usable in a library, where full control over signal handlers cannot be assumed?

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.