【发布时间】:2013-02-28 13:07:57
【问题描述】:
我的环境:
- FreeBSD 9.1,我得到了一个预分叉的多进程环境。
- 一个主进程,一个轮询器来管理工作人员(决定忙碌或可用)和工作人员。
如果我将SIGTERM 发送到主进程,那没关系,如果工人数量不高。如果high (x > 20) 我得到段错误。
我有两个 truss 输出,一个是正常出口,另一个是 seg 错误。
核心文件的gdb输出:
Die: DW_TAG_unspecified_type (abbrev = 62, offset = 1535499)
has children: FALSE
attributes:
DW_AT_name (DW_FORM_strp) string: "decltype(nullptr)"
Dwarf Error: Cannot find type of die [in module /usr/local/lib/gcc46/libstdc++.so.6]
Die: DW_TAG_unspecified_type (abbrev = 62, offset = 1535499)
has children: FALSE
attributes:
DW_AT_name (DW_FORM_strp) string: "decltype(nullptr)"
Dwarf Error: Cannot find type of die [in module /usr/local/lib/gcc46/libstdc++.so.6]
正常退出进程的truss输出:
> close(0) = 0 (0x0) close(7)
> = 0 (0x0) gettimeofday({1360957175.665250 },0x0) = 0 (0x0) write(5,"2013-02-15 21:39:35.665 [64591] "...,64) = 64 (0x40) close(5)
> = 0 (0x0)
>
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x
> 0) = 0 (0x0)
>
> sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
>
> .............. .............. so many same sigprocmask call
>
>
> sigprocmask(SIG_BLOCK,SIGHUP|SIGINT|SIGQUIT|SIGKILL|SIGPIPE|SIGALRM|SIGTERM|SIGURG|SIGSTOP|SIGTSTP|SIGCONT|SIGCHLD|SIGTTIN|SIGTTOU|SIGIO|SIGXCPU|SIGXFSZ|SIGVTALRM|SIGPROF|SIGWINCH|SIGINFO|SIGUSR1|SIGUSR2,0x
> 0) = 0 (0x0)
> sigprocmask(SIG_SETMASK,0x0,0x0) = 0 (0x0)
> process exit, rval = 0
存在段错误的进程:
> gettimeofday({1360954514.547064 },0x0) = 0 (0x0)
> write(5,"2013-02-15 20:55:14.547 [7580] I"...,63) = 63 (0x3f)
> close(5) = 0 (0x0)
> SIGNAL 11 (SIGSEGV)
> process exit, rval = 0
当进程尝试调用 sigprocmask 时,它会给出 seg 错误。我没有明确调用 sigprocmask,并且怀疑调用 sigprocmask 的竞争条件。您是否遇到与 sigprocmask 相关的竞态条件?
【问题讨论】:
标签: c++ signals fork multiprocessing freebsd