0
我的環境:子進程給出退出功能賽格故障
- 的FreeBSD 9.1,我得到了一個預分叉多進程環境。
- 一個主流程,一個管理員工(決定繁忙或可用)和工人的輪詢器。
如果我發送一個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有關的競爭條件嗎?
嗨我解決了它是緩衝區溢出的問題。當程序試圖回饋內存時,我因爲BoF而採取seg故障。謝謝.. – iyasar 2013-04-11 07:08:17
對代碼始終使用valgring。總是。它適用於Linux和FreeBSD,沒有任何理由不使用它進行測試。它會將這個緩衝溢出問題更快地指向你,而不是你寫下這個問題。 它可能會通過查找其他問題來幫助您... – 2013-05-02 16:12:40