A fatal signal on a worker thread ends only that thread
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 68/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- c, linux
调研方向
Read src/syscall/signal.c and src/syscall/proc.c to trace how a Term or Core default action stops a vCPU, then compare the main-thread and worker paths in src/core/launch.c and src/runtime/forkipc.c. Add the worker-only SIGTERM reproduction described in the issue and extend test-rlimit-cpu for worker-only SIGXCPU. Done means either signal ends the whole thread group with the expected signal status.
由索引模型根据 Issue 内容生成。
描述
When a worker thread dequeues a signal whose default action is Term or Core, elfuse ends that worker and leaves the rest of the thread group running. On Linux, get_signal in kernel/signal.c calls do_group_exit for a fatal signal, so every thread in the group exits regardless of which one took it.
signal_deliver in src/syscall/signal.c returns -1 for a Term or Core default action and sets the exit code, but it does not request a group exit. The run loop in src/syscall/proc.c stops the vCPU on that -1. What happens next depends on the thread: the main thread's path in src/core/launch.c calls proc_request_exit_group whenever its run loop returns, while a worker's path in src/runtime/forkipc.c discards the return value of vcpu_run_loop, runs its robust-list and clear-child-tid cleanup, and exits alone.
RLIMIT_CPU (#475) is the case that exposes it: the sampler queues one SIGKILL at the hard limit and then returns, so if a worker dequeues it, the remaining threads run past the hard limit with nothing left to send it again. A default-action SIGXCPU at the soft limit has the same gap.
Reproduction: the main thread creates a spinning worker, then blocks SIGTERM with pthread_sigmask, sleeps, and sends kill(getpid(), SIGTERM). Only the worker can take the signal. On Linux the process dies with SIGTERM. Reading the code, elfuse ends only the worker and the main thread keeps running.
Follow-ups
- Request the group exit in delivery: a Term or Core default action taken on any thread ends the whole thread group with that signal's status, as
do_group_exitdoes on Linux. - Add a test with the reproduction above: a process-directed SIGTERM that only a worker can take ends the process with SIGTERM.
- Extend
test-rlimit-cpuwith a worker-only case: the main thread blocks SIGXCPU and spins, a worker spins with SIGXCPU at its default action, and the process ends with SIGXCPU at the soft limit. A SIGKILL case cannot force the worker, since SIGKILL cannot be blocked.
- 主要语言
- C
- 星标
- 278
- 派生
- 31
- 平均合并
- 2 天 22 小时
- 30 天内合并 PR
- 17
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/elfuse 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 52/100
维护者通常 3 天内回复
-
难度 4/5 3-5 天 新手友好度 48/100
维护者通常 3 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
InukaAsith/TwinDesk#84 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
CanadaHonk/porffor#426 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
FujiNetWIFI/fujinet-firmware#2221 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 77/100
raysan5/raylib.com#132 ·
-
难度 2/5 1-3 小时 新手友好度 72/100