| [ CnUnix ] in KIDS 글 쓴 이(By): guest (lopad) <211.218.38.184> 날 짜 (Date): 2003년 7월 30일 수요일 오전 09시 59분 12초 제 목(Title): [Q] signal handler가 계속 call됨. multithreaded daemon program에서 다음같은 내용의 core를 남기고 죽습니다. (gdb) where #0 0xdfb8e78c in sigvalid () from /usr/lib/libc.so.1 #1 0xdfb8e92e in sigismember () from /usr/lib/libc.so.1 #2 0xdf8a55e7 in sigacthandler () from /usr/lib/libthread.so.1 #3 <signal handler called> #4 0xdfb6d114 in longjmp () from /usr/lib/libc.so.1 #5 0x80b3f62 in hdl_signal () #6 0xdf897a4f in __sighndlr () from /usr/lib/libthread.so.1 #7 0xdf8a5b3d in sigacthandler () from /usr/lib/libthread.so.1 #8 <signal handler called> #9 0xdfb6d114 in longjmp () from /usr/lib/libc.so.1 #10 0x80b3f62 in hdl_signal () #11 0xdf897a4f in __sighndlr () from /usr/lib/libthread.so.1 #12 0xdf8a5b3d in sigacthandler () from /usr/lib/libthread.so.1 #13 <signal handler called> #14 0xdfb6d114 in longjmp () from /usr/lib/libc.so.1 ... (계속반복)... signal를 처리는 한 쓰레드만 담당하고 다른 모든 쓰레드는 signal를 ignore 시켰음. (kill -l로 해서 보이는 모든 signal) 그런데 이상하게 signal handler가 계속 불려서 스택이 깨지면서 죽는 것 같은데. 도무지 왜 이런 현상이 일어나는지 모르겠습니다. 그리고 어떤 signal이 발생했는지도 모르겠고요... 이럴때는 어떻게 debugging 해야 하나요? looping 하면서 죽으니... signal handler 함수는 다음과 같고요. void *sig_thread() { struct sigaction act, hupact; act.sa_handler = sig_seg; sigfillset(&act.sa_mask); act.sa_flags = SA_RESTART; hupact.sa_handler = sig_hup; sigfillset(&hupact.sa_mask); hupact.sa_flags = SA_RESTART; /* program error signal */ sigaction(SIGSEGV, &act, NULL); sigaction(SIGBUS, &act, NULL); sigaction(SIGILL, &act, NULL); sigaction(SIGFPE, &act, NULL); sigaction(SIGABRT, &act, NULL); sigaction(SIGHUP, &hupact, NULL); /* program error signal */ while (1) pause(); return NULL; } static void sig_seg(int sig) { int ret; char buf[100]; logfile(MY_LOG,"사망함. signal(%d)", sig); memset(buf, 0, sizeof(buf)); sprintf(buf, "/bin/gcore %d", getpid()); ret = system(buf); exit(1); } |