Forced termination of `aiotools.fork` is not working on macOS
- Dominant language
- Python
- Stars
- 670
- Forks
- 183
- Avg merge
- 17h 7m
- Merged PRs (30d)
- 358
Description
### What Operating System(s) are you seeing this problem on?
macOS 15.0.1
### Backend.AI version
main
### Describe the bug
After sending a SIGINT signal, if the process does not terminate within a specified period, `aiotool.afork()` sends a SIGKILL signal to forcibly terminate the process.
This mechanism works without issues on Linux, where it operates via `PidfdChildProcess`, but it is not functioning on macOS.
Debugging results suggest that the issue may be related to the timing of setting `self._terminated` to True.
This may be an upstream issue with `aiotools`, but as it is also affecting the behavior of Backend.AI, I am creating an issue for it.
### To Reproduce
1. Start the Backend.AI manager server.
1. Shut down the Redis container.
1. Press Ctrl + C to send the SIGINT signal.
1. Although below log appear, the SIGKILL signal is not actually sent. So, the manager process also does not terminate.
{code}
2024-11-06 14:26:38.036 WARNING aiotools.server [10753] Timeout during waiting for child processes; killing all
{code}
> [!NOTE]This example uses the manager component, but the issue can be reproduced with other components as well.
### Expected Behavior
The SIGKILL signal is sent successfully, and the manager process terminates.(Behavior on Linux.)
### Anything else?
None
JIRA Issue: BA-65
Contributor guide
Assessment
This issue has not been assessed yet.