From: Andrew P. <at...@pi...> - 2014-10-15 07:46:07
|
Is the stand-alone nsthreadtest program supposed to work? It dumps core for me on both Windows and Linux. In my own application on Windows, my connection thread tells a worker thread to do something using nsv, mutexes, and a condition variable. This is old code that works fine on AOLserver 4.0.x (on a different older Windows XP box), but now with Naviserver on Windows 7, the worker thread seems to never wake up, and never do anything at all. I'm still in the middle of tracking down exactly what's going on there, but it made me suspicious... So I ran nsthreadtest, which crashed. Output and stack traces are below. The output from the Linux and Windows runs is slightly different, but they both appear to during (or after) "tls cleanup 1", after calling Tcl_FinalizeThread(). Any ideas? Btw, I tested two recent points in the commit history. The current head of my clone right after merging in all of Gustaf's latest commits, here: https://bitbucket.org/apiskors/naviserver/commits/28b8eb8e7b126313e32e95fb9ba17d77a789d68a https://bitbucket.org/apiskors/naviserver/commits/all And earlier today, my clone prior to merging in the last three days or so of Gustaf's changes. Unsurprisingly, they both failed exactly the same way. Windows 7 64-bit, Naviserver compiled 32-bit, run under WinDbg: ------------------------------------------------------------ [-main-][Wed Oct 15 01:40:19 2014]: sema initialized to 3 [-main-][Wed Oct 15 01:40:19 2014]: pid = 3332 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 0 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 1 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 2 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 3 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 4 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 5 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 6 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 7 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 8 [-main-][Wed Oct 15 01:40:19 2014]: starting work thread 9 [-work:0-][Wed Oct 15 01:40:19 2014]: rwlock read aquired [-work:1-][Wed Oct 15 01:40:19 2014]: rwlock read aquired [-main-][Wed Oct 15 01:40:20 2014]: sema post 10 [-work:1-][Wed Oct 15 01:40:20 2014]: enter critical section once [-work:1-][Wed Oct 15 01:40:20 2014]: enter critical section twice [-work:1-][Wed Oct 15 01:40:20 2014]: got semaphore posted from main [-work:1-][Wed Oct 15 01:40:20 2014]: rwlock unlocked [-work:1-][Wed Oct 15 01:40:20 2014]: exiting [-work:1-][Wed Oct 15 01:40:20 2014]: tls cleanup 1 ChildEBP RetAddr WARNING: Frame IP not in any known module. Following frames may be wrong. 029cfaec 10086f57 0x0 029cfb10 10086efb tcl85!Tcl_GetMemoryInfo+0x747 029cfb18 1008601a tcl85!Tcl_GetMemoryInfo+0x6eb 029cfb20 10041abb tcl85!Tcl_GetThreadData+0x5a 029cfb2c 63d336e9 tcl85!Tcl_FinalizeThread+0xb 029cfb50 63d33d11 nsthread!NsCleanupTls+0xe9 [z:\web\ns-fork\naviserver\nsthread\tls.c @ 191] 029cfb68 63d3a7da nsthread!DllMain+0x101 [z:\web\ns-fork\naviserver\nsthread\winthread.c @ 183] 029cfbb4 63d3a701 nsthread!__DllMainCRTStartup+0xca [f:\dd\vctools\crt_bld\self_x86\crt\src\dllcrt0.c @ 330] 029cfbc8 77c899a0 nsthread!_DllMainCRTStartup+0x21 [f:\dd\vctools\crt_bld\self_x86\crt\src\dllcrt0.c @ 293] 029cfbe8 77ca7e5f ntdll32!LdrpCallInitRoutine+0x14 029cfc8c 77ca8046 ntdll32!LdrShutdownThread+0xe6 029cfc9c 63d3819a ntdll32!RtlExitUserThread+0x2a 029cfcac 63d344ec nsthread!_endthreadex+0x2a [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 367] 029cfcb8 00a414d9 nsthread!Ns_ThreadExit+0xc [z:\web\ns-fork\naviserver\nsthread\winthread.c @ 735] 029cfd2c 63d32dd6 nsthreadtest!WorkThread+0x2a9 [z:\web\ns-fork\naviserver\nsthread\nsthreadtest.c @ 209] 029cfd98 63d346fc nsthread!NsThreadMain+0x86 [z:\web\ns-fork\naviserver\nsthread\thread.c @ 219] 029cfdb0 63d38113 nsthread!ThreadMain+0x5c [z:\web\ns-fork\naviserver\nsthread\winthread.c @ 872] 029cfdec 63d380b4 nsthread!_callthreadstartex+0x53 [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 314] 029cfdf8 7746338a nsthread!_threadstartex+0x84 [f:\dd\vctools\crt_bld\self_x86\crt\src\threadex.c @ 297] 029cfe04 77c89f72 kernel32!BaseThreadInitThunk+0xe 029cfe44 77c89f45 ntdll32!__RtlUserThreadStart+0x70 029cfe5c 00000000 ntdll32!_RtlUserThreadStart+0x1b Ubuntu 12.04.3 LTS, 64-bit, run normally, gdb on core file: ------------------------------------------------------------ $ /usr/local/nsd-4.99.6-dtk-2/bin/nsthreadtest [-main-][Wed Oct 15 02:31:46 2014]: sema initialized to 3 [-main-][Wed Oct 15 02:31:46 2014]: pid = 15263 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 0 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 1 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 2 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 3 [-work:0-][Wed Oct 15 02:31:46 2014]: rwlock read aquired [-work:1-][Wed Oct 15 02:31:46 2014]: rwlock read aquired [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 4 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 5 [-work:3-][Wed Oct 15 02:31:46 2014]: rwlock read aquired [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 6 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 7 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 8 [-main-][Wed Oct 15 02:31:46 2014]: starting work thread 9 -work:9- -main- 7f06b0339700 0 1413354706 0x4022f0 0x9 15274 -work:8- -main- 7f06b034d700 0 1413354706 0x4022f0 0x8 15273 -work:7- -main- 7f06b0361700 0 1413354706 0x4022f0 0x7 15272 -work:6- -main- 7f06b0375700 0 1413354706 0x4022f0 0x6 15271 -work:5- -main- 7f06b0389700 0 1413354706 0x4022f0 0x5 15270 -work:4- -main- 7f06b039d700 0 1413354706 0x4022f0 0x4 15269 -work:3- -main- 7f06b03b1700 0 1413354706 0x4022f0 0x3 15268 -work:2- -main- 7f06b03c5700 0 1413354706 0x4022f0 0x2 15267 -work:1- -main- 7f06b03d9700 0 1413354706 0x4022f0 0x1 15266 -work:0- -main- 7f06b03ff700 0 1413354706 0x4022f0 (nil) 15265 -dumper- -main- 7f06af1e2700 0 1413354706 0x4028e0 (nil) 15264 -main- {} 7f06b03db700 1 1413354706 (nil) (nil) 15263 ns:rw:0 {} 6 10 0 0.000000 0.000000 0.000001 ns:sm:0 {} 5 0 0 0.000000 0.000000 0.000000 busylock {} 4 1 0 0.000000 0.000000 0.000000 msglock {} 3 16 2 0.000089 0.000047 0.000428 dumplock {} 2 1 0 0.000000 0.000000 0.000000 startlock {} 1 0 0 0.000000 0.000000 0.000000 ns:cs:0 {} 0 145 7 0.000049 0.000034 0.000183 thread0x7f06b0339700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b034d700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b0361700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b0375700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b0389700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b039d700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b03b1700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 1 1 0 480 0 0} {1024 14 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b03c5700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 15 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b03ff700 {32 0 0 0 0 0 0} {64 14 2 0 80 0 0} {128 6 2 0 96 0 0} {256 3 1 0 176 0 0} {512 1 1 0 480 0 0} {1024 11 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b03d9700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 1 1 0 480 0 0} {1024 14 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06af1e2700 {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 7 1 0 48 0 0} {256 0 0 0 0 0 0} {512 2 1 1 0 0 0} {1024 13 3 2 800 0 0} {2048 8 2 2 0 0 0} {4096 3 1 0 3366 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} thread0x7f06b03db700 {32 0 0 0 0 0 0} {64 248 8 0 296 0 0} {128 0 2 0 96 0 0} {256 45 18 0 3456 0 0} {512 1 1 0 480 0 0} {1024 14 1 0 800 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} shared {32 0 0 0 0 0 0} {64 0 0 0 0 0 0} {128 0 0 0 0 0 0} {256 0 0 0 0 0 0} {512 0 0 0 0 0 0} {1024 0 0 0 0 0 0} {2048 0 0 0 0 0 0} {4096 0 0 0 0 0 0} {8192 0 0 0 0 0 0} {16384 0 0 0 0 0 0} [-work:0-][Wed Oct 15 02:31:47 2014]: enter critical section once [-work:0-][Wed Oct 15 02:31:47 2014]: enter critical section twice [-work:0-][Wed Oct 15 02:31:47 2014]: got semaphore posted from main [-work:1-][Wed Oct 15 02:31:47 2014]: enter critical section once [-work:1-][Wed Oct 15 02:31:47 2014]: enter critical section twice [-work:1-][Wed Oct 15 02:31:47 2014]: got semaphore posted from main [-work:0-][Wed Oct 15 02:31:47 2014]: rwlock unlocked [-work:0-][Wed Oct 15 02:31:47 2014]: exiting [-work:1-][Wed Oct 15 02:31:47 2014]: rwlock unlocked [-work:1-][Wed Oct 15 02:31:47 2014]: exiting [-work:3-][Wed Oct 15 02:31:47 2014]: enter critical section once [-work:3-][Wed Oct 15 02:31:47 2014]: enter critical section twice [-work:3-][Wed Oct 15 02:31:47 2014]: got semaphore posted from main [-work:3-][Wed Oct 15 02:31:47 2014]: rwlock unlocked [-work:3-][Wed Oct 15 02:31:47 2014]: exiting [-work:2-][Wed Oct 15 02:31:47 2014]: rwlock write aquired [-work:0-][Wed Oct 15 02:31:47 2014]: tls cleanup 0 [-work:1-][Wed Oct 15 02:31:47 2014]: tls cleanup 1 Segmentation fault (core dumped) warning: Can't read pathname for load map: Input/output error. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Core was generated by `/usr/local/nsd-4.99.6-dtk-2/bin/nsthreadtest'. Program terminated with signal 11, Segmentation fault. #0 0x0000000000000000 in ?? () (gdb) bt #0 0x0000000000000000 in ?? () #1 0x00007f06afb641e3 in ?? () from /usr/lib/libtcl8.5.so.0 #2 0x00007f06afb642f1 in ?? () from /usr/lib/libtcl8.5.so.0 #3 0x00007f06afb102f2 in Tcl_FinalizeThread () from /usr/lib/libtcl8.5.so.0 #4 0x00007f06afdc114a in CleanupTls (arg=<optimized out>) at pthread.c:816 #5 0x00007f06affcbc83 in __nptl_deallocate_tsd () at pthread_create.c:156 #6 0x00007f06affcbea8 in start_thread (arg=0x7f06b03ff700) at pthread_create.c:315 #7 0x00007f06af7d73fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112 #8 0x0000000000000000 in ?? () (gdb) -- Andrew Piskorski <at...@pi...> |