X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-0.2 required=5.0 tests=AWL,BAYES_00,SARE_BAYES_5x7,TW_CB,TW_XF,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-cybertrench.com-virus-scan: clean Date: Tue, 13 Jul 2010 23:17:11 +0200 From: Corvus Corax To: cygwin AT cygwin DOT com Subject: Re: Sending SIGUSR1 to thread in nanosleep causes segfault Message-ID: <20100713231711.2e804449@CorvusMC.home> In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/1ao6fOA0w2ocqZ+K/nRMSpj" Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --MP_/1ao6fOA0w2ocqZ+K/nRMSpj Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Here are some backtraces: --MP_/1ao6fOA0w2ocqZ+K/nRMSpj Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=backtrace.txt snapshot: cygwin1-20100707.dll.bz2 System AMD64 CPU - Windows XP Professional 64 bit Edition, Version 2003, Service Pack 2 Program is test_case_1_sleep.c: 1 /** 2 * small test program whether signals between threads work as they should 3 */ 4 5 #include 6 #include 7 #include 8 9 void sighandler(int sig) { 10 write(2,".",1); 11 return; 12 } 13 14 void* threadstart(void* arg) { 15 16 while (1) { 17 sleep(1); 18 } 19 } 20 21 int main(char** argc, int argv) { 22 23 pthread_t testthread1; 24 struct sigaction action; 25 26 action.sa_handler=sighandler; 27 action.sa_flags=0; 28 sigfillset( &action.sa_mask ); 29 sigaction(SIGUSR1,&action,NULL); 30 31 pthread_create(&testthread1,NULL,threadstart,NULL); 32 while (1) { 33 pthread_kill(testthread1,SIGUSR1); 34 } 35 } Generally those stack traces seem to be pretty borked. I assume as a result of heavy stack corruption But maybe you can read something out of this mess. Here are several variants I got: (gdb) run =============================================================================== This is the most common and reproducable backtrace: Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1788.0x6e4] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1788.0x250] [New thread 1788.0xc8] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1788.0xc8] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1788.0xc8): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1788.0x250): #0 0x7d61c876 in ?? () #1 0x7d4d08ac in KERNEL32!CreateThread () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002ec in ?? () #3 0x00000000 in ?? () Thread 1 (thread 1788.0x6e4): #0 0x7d61c8a6 in ?? () #1 0x7d4da99c in KERNEL32!GetNlsSectionName () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002e8 in ?? () #3 0x00000000 in ?? () #0 0x18d4db2c in ?? () =============================================================================== But the occasional cases went more fun: Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1780.0x1ec] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1780.0x5d0] [New thread 1780.0xa8] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1780.0xa8] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1780.0xa8): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1780.0x5d0): #0 0x7d61e26f in ?? () #1 0x7d534baf in KERNEL32!GetCalendarInfoA () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002c8 in ?? () #3 0x0070c660 in ?? () #4 0x0070c968 in ?? () #5 0x61027a82 in setup_handler (sig=0, handler=0x0, siga=@0x0, tls=0x2c8) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/exceptions.cc:885 Backtrace stopped: frame did not save the PC Thread 1 (thread 1780.0x1ec): #0 0x7d61c846 in ?? () #1 0x7d4d8c9e in KERNEL32!GetCommandLineW () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002b0 in ?? () #3 0x00000000 in ?? () #0 0x18d4db2c in ?? () =============================================================================== Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1852.0xbc] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1852.0x428] [New thread 1852.0x588] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1852.0x588] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1852.0x588): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1852.0x428): #0 0x7d61c876 in ?? () #1 0x7d4d08ac in KERNEL32!CreateThread () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002ec in ?? () #3 0x00000000 in ?? () Thread 1 (thread 1852.0xbc): #0 0x7d4da92f in KERNEL32!GetNlsSectionName () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #1 0x00000018 in ?? () #2 0x610e0b71 in pthread_kill (thread=0xb89788, sig=30) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:2624 #3 0x610bfd06 in _sigfe () from /usr/bin/cygwin1.dll #4 0x00401064 in sighandler (sig=1) at test_case_1_sleep.c:12 #5 0x61006ea3 in _cygwin_exit_return () at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/dcrt0.cc:956 #6 0x61004aa6 in _cygtls::call2 (this=0x22ce64, func=0x61006740 , arg=0x0, buf=0x22cdd4) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:68 #7 0x61004b4b in _cygtls::call (func=0x61006740 , arg=0x0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:61 #8 0x6100667a in _dll_crt0 AT 0 () at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/dcrt0.cc:978 #9 0x00401172 in cygwin_crt0 () #10 0x0040103d in mainCRTStartup () #0 0x18d4db2c in ?? () =============================================================================== Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1820.0x74c] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1820.0x440] [New thread 1820.0x5a0] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1820.0x5a0] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1820.0x5a0): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1820.0x440): #0 0x7d61c876 in ?? () #1 0x7d4d08ac in KERNEL32!CreateThread () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002ec in ?? () #3 0x00000000 in ?? () Thread 1 (thread 1820.0x74c): #0 0x7d4d8e61 in KERNEL32!BaseProcessInitPostImport () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #1 0x0022cbb8 in ?? () #2 0x610c5b35 in sig_send (p=0x7d4d1504, si=@0x18d4fffc, tls=0x3000) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/sigproc.cc:723 Backtrace stopped: frame did not save the PC #0 0x18d4db2c in ?? () =============================================================================== Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1580.0x6a0] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1580.0x49c] [New thread 1580.0x780] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1580.0x780] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1580.0x780): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1580.0x49c): #0 0x7d534b9d in KERNEL32!GetCalendarInfoA () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #1 0x61027a82 in setup_handler (sig=30, handler=0x401040, siga=@0x61239b70, tls=0x18d4ce64) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/exceptions.cc:885 #2 0x610285b9 in sigpacket::process (this=0x70ccb0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/exceptions.cc:1288 #3 0x610c672b in wait_sig () at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/sigproc.cc:1271 #4 0x61003ff1 in cygthread::callfunc (this=0x611620a0, issimplestub=false) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygthread.cc:50 #5 0x61004111 in cygthread::stub (arg=0x611620a0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygthread.cc:98 #6 0x61004aa6 in _cygtls::call2 (this=0x70ce64, func=0x610040b0 , arg=0x611620a0, buf=0x70ce04) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:68 #7 0x61004b4b in _cygtls::call (func=0x610040b0 , arg=0x611620a0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:61 #8 0x6106d208 in threadfunc_fe (arg=0x611620a0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/init.cc:30 #9 0x7d4dfe37 in KERNEL32!GetConsoleOutputCP () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #10 0x611620a0 in cygthread::exiting () from /usr/bin/cygwin1.dll #11 0x00000000 in ?? () Thread 1 (thread 1580.0x6a0): #0 0x7d61c8a6 in ?? () #1 0x7d4da99c in KERNEL32!GetNlsSectionName () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002e8 in ?? () #3 0x00000000 in ?? () #0 0x18d4db2c in ?? () =============================================================================== Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 1384.0x6ac] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 1384.0x72c] [New thread 1384.0x1e4] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 1384.0x1e4] 0x18d4db2c in ?? () (gdb) thread apply all bt Thread 3 (thread 1384.0x1e4): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 1384.0x72c): #0 0x7d61c876 in ?? () #1 0x7d4d08ac in KERNEL32!CreateThread () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002ec in ?? () #3 0x00000000 in ?? () Thread 1 (thread 1384.0x6ac): #0 0x7d61cea4 in ?? () #1 0x6106e312 in CreateEventW AT 16 (lpEventAttributes=0x611742ac, bManualReset=0, bInitialState=, lpName=0x0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/kernel32.cc:43 #2 0x6106e482 in CreateEventA AT 16 (lpEventAttributes=0x611742ac, bManualReset=0, bInitialState=0, lpName=0x0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/kernel32.cc:66 #3 0x610c5c67 in sig_send (p=0x60fe0000, si=@0x22cbdc, tls=0x18d4ce64) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/sigproc.cc:667 #4 0x610e0b71 in pthread_kill (thread=0xb89788, sig=30) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:2624 #5 0x610bfd06 in _sigfe () from /usr/bin/cygwin1.dll #6 0x00401064 in sighandler (sig=1) at test_case_1_sleep.c:12 #7 0x61006ea3 in _cygwin_exit_return () at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/dcrt0.cc:956 #8 0x61004aa6 in _cygtls::call2 (this=0x22ce64, func=0x61006740 , arg=0x0, buf=0x22cdd4) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:68 #9 0x61004b4b in _cygtls::call (func=0x61006740 , arg=0x0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:61 #10 0x6100667a in _dll_crt0 AT 0 () at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/dcrt0.cc:978 #11 0x00401172 in cygwin_crt0 () #12 0x0040103d in mainCRTStartup () #0 0x18d4db2c in ?? () =============================================================================== Starting program: /home/Raven/OpenPilot/flight/PiOS.posix/posix/Libraries/FreeRTOS/Source/portable/GCC/Posix/corvuscorax/a.exe [New thread 324.0x4e8] Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77d40000 not found. Error: dll starting at 0x77c20000 not found. Error while mapping shared library sections: /cygdrive/c/WINDOWS/SysWOW64/ntdll32.dll: No such file or directory. [New thread 324.0x238] [New thread 324.0x704] Program received signal SIGSEGV, Segmentation fault. [Switching to thread 324.0x238] 0x610042a6 in _cygtls::push (this=0x70bdf0, addr=0) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc:190 190 /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc: No such file or directory. in /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/cygtls.cc Current language: auto; currently c++ (gdb) thread apply all bt Thread 3 (thread 324.0x704): #0 0x18d4db2c in ?? () #1 0x00000001 in ?? () #2 0x18d4cdc8 in ?? () #3 0x610e30b5 in pthread::thread_init_wrapper (arg=0xb89788) at /netrel/src/cygwin-snapshot-20100707-1/winsup/cygwin/thread.cc:1722 #4 0xffffffff in ?? () #5 0x00000000 in ?? () Thread 2 (thread 324.0x238): #0 0x7d4e237e in KERNEL32!GetConsoleOutputCP () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #1 0x0070c0db in ?? () #2 0x40010006 in ?? () #3 0x00000000 in ?? () Thread 1 (thread 324.0x4e8): #0 0x7d61c846 in ?? () #1 0x7d4d8c9e in KERNEL32!GetCommandLineW () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll #2 0x000002a0 in ?? () #3 0x00000000 in ?? () #0 0x7d4e237e in KERNEL32!GetConsoleOutputCP () from /cygdrive/c/WINDOWS/syswow64/kernel32.dll =============================================================================== thats it - didnt get any more variants so far - tried about 15-25 times =============================================================================== --MP_/1ao6fOA0w2ocqZ+K/nRMSpj Content-Type: text/plain; charset=us-ascii -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple --MP_/1ao6fOA0w2ocqZ+K/nRMSpj--