我的环境:
如果我向主要流程发送SIGTERM
,那么如果工人数量不高,那就没问题。如果high (x > 20)
我得到seg错误。
我有两个桁架输出,其中一个是正常退出,另一个是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]
正常退出流程的桁架输出:
> 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有关的竞争条件吗?
答案 0 :(得分:0)
当进程尝试调用sigprocmask
时,它会产生seg错误
我没有看到。看来,崩溃是在第五个文件描述符关闭之后发生的。进一步看来,描述符5在关闭之前写入了一条日志消息(带有时间戳)。
你的“主”守护进程试图清理,并试图死。我建议,在运行时将gdb附加到它 - 就在发送SIGTERM之前。发送SIGTERM时,告诉gdb继续。
发送SIGSEGV时,请进行调查。
我还强烈建议在valgrind下运行守护进程。你可能会以这种方式捕获很多东西......