This is the mail archive of the cygwin mailing list for the Cygwin project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Hi, I had strange hangs and segfaults with a program, and it happens that detached thread termination may segfault: #include <windows.h> #include <pthread.h> #include <stdio.h> void *f(void *foo) { return(NULL); } pthread_t t; pthread_attr_t attr; int main(void) { if (pthread_attr_init(&attr)) perror("pthread_attr_init"); if (pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED)) perror("pthread_attr_setdetachstate"); if (pthread_create(&t,&attr,f,NULL)) perror("pthread_create"); Sleep(10000); return 0; } segfaults with latest net cygwin: Stack trace: Frame Function Args 0022EAC8 7C802542 (00000708, 0000EA60, 000000A4, 0022EB04) WaitForSingleObject+18 (which is pop %ebp after calling WaitForSingleObjectEx) 0022EBD8 61088618 (00000000, 7C859BB0, 40010006, 00000000) sigemptyset+4616 0022ECC8 610865FC (00000000, 00000000, 00000001, 0022ED78) writev+1821 0022ED48 61086B1B (00000006, 00000001, 00000000, 00000000) writev+3132 0022EDF8 61086CD3 (00000B38, 00000006, 0022EE28, 61086EC7) writev+3572 0022EE08 61086CFC (00000006, 00000000, 004B2000, 004B2000) writev+3613 0022EE28 61086EC7 (7C809F90, FFFFFFFF, 7C809F8A, 004B0000) sigfillset+343 0022EE58 610AA8B2 (00403020, 00403030, 0022EE88, 6109B63C) setstate+2562 0022EE88 6104EC66 (004B2620, FFFFFFFF, 004B2600, 00000000) lsearch+118 0022EEB8 610A11CE (00403030, 00403020, 00401050, 00000000) pthread_getspecific+13806 0022EEE8 610844FF (00000001, 004B25A8, 004B0090, 610A5E22) cygwin1!aclcheck+62431 0022EFD8 61004DD2 (0022EFF0, 0022F03C, 00342320, 002310A0) exit+1474 0022FF88 6100594F (00000000, 00000000, 00000000, 00000000) dll_crt0+207 End of stack trace I don't know why registers are not dumped. Running it through gdb or strace just makes it work... Adding a Sleep(1000); in the f() function before returning prevents from the crash, so I guess f() returning fast triggers a race condition in the pthread code. Regards, Samuel
Attachment:
cygcheck.out
Description: Text document
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |