|
2015-09-24
| ||
| 11:19 | • Closed ticket [57945b574a]: lock in forking process under heavy multithreading</... artifact: d3067b6188 user: jan.nijtmans | |
|
2015-09-23
| ||
| 12:21 | • Ticket [57945b574a]: 3 changes artifact: 6429a791a6 user: jan.nijtmans | |
| 12:08 | • Open ticket [57945b574a]. artifact: 525dca24aa user: dgp | |
|
2015-07-23
| ||
| 17:11 | • Closed ticket [57945b574a]. artifact: bd8a5510f9 user: jan.nijtmans | |
| 17:09 | Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy m... check-in: 9f8b7bea53 user: jan.nijtmans tags: trunk | |
| 16:53 | Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy m... check-in: 6abeca2800 user: jan.nijtmans tags: core-8-5-branch | |
|
2015-07-13
| ||
| 12:56 | • Ticket [57945b574a] lock in forking process under heavy multithreading statu... artifact: d7728353c4 user: dkf | |
|
2015-06-08
| ||
| 10:59 | • Ticket [57945b574a]: 3 changes artifact: 4a5cbe049f user: gustafn | |
| 10:57 | • Ticket [57945b574a]: 3 changes artifact: 00d94f60aa user: gustafn | |
|
2015-05-18
| ||
| 21:02 | • Ticket [57945b574a]: 3 changes artifact: d85239c5c9 user: gustafn | |
| 18:26 | • Ticket [57945b574a]: 3 changes artifact: bd05425641 user: mistachkin | |
| 09:41 | • Ticket [57945b574a]: 3 changes artifact: 07cc45d929 user: gustafn | |
| 01:57 | • Ticket [57945b574a]: 3 changes artifact: 5aa21c2442 user: mistachkin | |
|
2015-05-17
| ||
| 11:02 | • Ticket [57945b574a]: 4 changes artifact: 07e2005d2f user: dkf | |
|
2015-05-16
| ||
| 23:11 | • Ticket [57945b574a]: 3 changes artifact: 1aa437b3d1 user: mistachkin | |
| 13:49 | • Ticket [57945b574a]: 4 changes artifact: f27437e7da user: dkf | |
| 13:47 | • Ticket [57945b574a]: 4 changes artifact: 7a5f972d92 user: dkf | |
| 06:51 | • Ticket [57945b574a]: 3 changes artifact: 955a2addb5 user: mistachkin | |
| 06:50 | • Ticket [57945b574a]: 3 changes artifact: 549ed2d3d5 user: mistachkin | |
| 06:23 | • Ticket [57945b574a]: 5 changes artifact: 64ca2961f2 user: dkf | |
| 06:17 | • Ticket [57945b574a]: 5 changes artifact: da5c8ef15c user: dkf | |
|
2015-04-09
| ||
| 23:08 | • Ticket [57945b574a]: 3 changes artifact: c7b8730c26 user: mistachkin | |
| 19:57 | • Ticket [57945b574a]: 3 changes artifact: daf74dfc79 user: mistachkin | |
| 19:53 | Add new public Tcl C API to allow a mutex to be unlocked and then finalized atomically. Candidate f... check-in: 30dc11630f user: mistachkin tags: bug-57945b574a | |
| 16:16 | • New ticket [57945b574a] lock in forking process under heay multithreading. artifact: e6da8733ba user: gustafn | |
lock in forking process under heavy multithreading
The following happens in NaviServer on a Linux machine under a substantial multithreading load (several hundred users are concurrently active). Normally, NaviServer redefines Tcl's "exec" command via nsproxy [1], but in this instance, tcl exec is used. During the processing of a request in a thread, "exec" is used. This exec however hangs forever in a mutex lock during Tcl_InitNotifier() called after fork (probaly called from AtForkChild() in tclUnixNotify.c). sorry, i have no simple test script, and i am not sure, we can get there a version compiled with -g. Hope that the traceback rings a bell... [1] http://naviserver.sourceforge.net/n/nsproxy/files/ns_proxy.html #0 0x00007ff8a66de89c in __lll_lock_wait () from /lib/x86_64-linux-gnu/libpthread.so.0 #1 0x00007ff8a66da065 in _L_lock_858 () from /lib/x86_64-linux-gnu/libpthread.so.0 #2 0x00007ff8a66d9eba in pthread_mutex_lock () from /lib/x86_64-linux-gnu/libpthread.so.0 #3 0x00007ff8a5623d6c in Tcl_MutexLock () from /usr/local/ns/lib/libtcl8.5.so #4 0x00007ff8a5624d70 in Tcl_InitNotifier () from /usr/local/ns/lib/libtcl8.5.so #5 0x00007ff8a69ad296 in fork () from /lib/x86_64-linux-gnu/libc.so.6 #6 0x00007ff8a56224fc in TclpCreateProcess () from /usr/local/ns/lib/libtcl8.5.so #7 0x00007ff8a55f76ac in TclCreatePipeline () from /usr/local/ns/lib/libtcl8.5.so #8 0x00007ff8a55f8209 in Tcl_OpenCommandChannel () from /usr/local/ns/lib/libtcl8.5.so #9 0x00007ff8a55d86df in Tcl_ExecObjCmd () from /usr/local/ns/lib/libtcl8.5.so #10 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #11 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #12 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #13 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #14 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #15 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #16 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #17 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #18 0x00007ff8a55c2c30 in TclCompEvalObj () from /usr/local/ns/lib/libtcl8.5.so #19 0x00007ff8a5579b85 in TclEvalObjEx () from /usr/local/ns/lib/libtcl8.5.so #20 0x00007ff8a5581b4a in Tcl_ForeachObjCmd () from /usr/local/ns/lib/libtcl8.5.so #21 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #22 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #23 0x00007ff8a55c2c30 in TclCompEvalObj () from /usr/local/ns/lib/libtcl8.5.so #24 0x00007ff8a5579b85 in TclEvalObjEx () from /usr/local/ns/lib/libtcl8.5.so #25 0x00007ff8a55fd43f in Tcl_UplevelObjCmd () from /usr/local/ns/lib/libtcl8.5.so #26 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #27 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #28 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #29 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #30 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #31 0x00007ff8a55c2c30 in TclCompEvalObj () from /usr/local/ns/lib/libtcl8.5.so #32 0x00007ff8a5579b85 in TclEvalObjEx () from /usr/local/ns/lib/libtcl8.5.so #33 0x00007ff8a55fd43f in Tcl_UplevelObjCmd () from /usr/local/ns/lib/libtcl8.5.so #34 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #35 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #36 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #37 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #38 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #39 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #40 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #41 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #42 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #43 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #44 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #45 0x00007ff8a55c2c30 in TclCompEvalObj () from /usr/local/ns/lib/libtcl8.5.so #46 0x00007ff8a5579b85 in TclEvalObjEx () from /usr/local/ns/lib/libtcl8.5.so #47 0x00007ff8a55fd43f in Tcl_UplevelObjCmd () from /usr/local/ns/lib/libtcl8.5.so #48 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #49 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #50 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #51 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #52 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #53 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #54 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #55 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #56 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #57 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #58 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #59 0x00007ff8a55c2c30 in TclCompEvalObj () from /usr/local/ns/lib/libtcl8.5.so #60 0x00007ff8a5579b85 in TclEvalObjEx () from /usr/local/ns/lib/libtcl8.5.so #61 0x00007ff8a55fd43f in Tcl_UplevelObjCmd () from /usr/local/ns/lib #62 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #63 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #64 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #65 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #66 0x00007ff8a55bbdb2 in TclExecuteByteCode () from /usr/local/ns/lib/libtcl8.5.so #67 0x00007ff8a55fda03 in TclObjInterpProcCore () from /usr/local/ns/lib/libtcl8.5.so #68 0x00007ff8a5577a4e in TclEvalObjvInternal () from /usr/local/ns/lib/libtcl8.5.so #69 0x00007ff8a55793a1 in TclEvalEx () from /usr/local/ns/lib/libtcl8.5.so #70 0x00007ff8a5579ab6 in Tcl_EvalEx () from /usr/local/ns/lib/libtcl8.5.so #71 0x00007ff8a6d1a7f3 in Ns_TclEvalCallback (interp=0xccd40000, cbPtr=0xe1d5660, result=0x0) at tclcallbacks.c:174 #72 0x00007ff8a6d300fe in NsTclRequestProc (arg=0xe1d5660, conn=0xa37e00) at tclrequest.c:441 #73 0x00007ff8a6d03cd5 in Ns_ConnRunRequest (conn=0xa37e00) at op.c:293 #74 0x00007ff8a6d09f24 in ConnRun (argPtr=0xc89e270, connPtr=0xa37e00) at queue.c:1513 #75 0x00007ff8a6d093a7 in NsConnThread (arg=0xc89e270) at queue.c:1229 #76 0x00007ff8a5869a04 in NsThreadMain (arg=0x26a028f0) at thread.c:227 #77 0x00007ff8a586b153 in ThreadMain (arg=0x26a028f0) at pthread.c:809 #78 0x00007ff8a66d7e9a in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0 #79 0x00007ff8a69e13fd in clone (
9f8b7bea53Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy multithreading. Thanks to Joe Mistachkin for the implementation of the fix, and Gustaf Neumann for the original report and testing the fix. check-in2015-07-23 17:09:586abeca2800Fix bug [57945b574a6df0332efc4ac96b066f7c347b28f7|57945b574a]: lock in forking process under heavy multithreading. Thanks to Joe Mistachkin for the implementation of the fix, and Gustaf Neumann for the original report and testing the fix. check-in2015-07-23 16:53:4230dc11630fAdd new public Tcl C API to allow a mutex to be unlocked and then finalized atomically. Candidate fix for bug [57945b574a]. check-in2015-04-09 19:53:39
Candidate fix on associated branch. Basically, the "fix" here is to avoid finalizing a locked mutex *while* preventing other threads from grabbing it.
Ideally, this fix should be applied to both 8.5 and 8.6.
We could certainly go with this immediately if we used an internal stub table entry. Public functions need documenting (I'd say testing too, but this one would be awful to do that with). I'll start the TIP process.
Draft of doc changes now on branch.
I hereby formally request "fast-track" TIP approval for the next patch releases of 8.5.x and 8.6.x... :)
TIP is now in. I'll request an immediate review and vote ASAP.
We really should backport this to 8.5 as well; otherwise, they'll have to just live with this bug.
Without exposing as a public API, for sure. I'm less certain about making it public, though I suppose it could go in tclInt.decls and then be exposed in the public API by the TIP in 8.6.5. (I'm pretty sure that the API generator supports putting the same function in both places, as that is necessary for some of the namespace API that got exposed in 8.6(?).)
I've run the Thread package tests on trunk, inserting a small delay in Tcl_MutexLock() and several tests fail, including one that hung using the modified code on the branch. I think the Thread package tests in question may be too sensitive to timing issues.
just a comment: i am running the first (candiate) patch since about a month on one of our systems without bad side effects, and the bug did not show up again. Joe, many thanks for providing the patch!
Thanks for the testing. Would it be possible for you to test the latest code on the branch? It's been modified, based on important code review feedback from Alexandre Ferrieux, to avoid some potential issues, including deadlocks. It would be quite valuable for us if we could find out if these changes still solve the original problem.
i won't be able to test before the weekend, but can give it a try then... The original problem happened once in a while (e.g. once or twice per week) on a quite busy machine with a few hundred users active users in a system based on tcl8.5, so i am not sure that i can recreate it...
I was testing naviserver with these changes, calling tcl "exec" with syntetic and real-world tests for a couple of days and everything looks ok to me. At least the original problem is apparently solved.
... to be clear: i was testing with the version of the "experimental" branch.
Fixed in core-8-5-branch and trunk
This patch completely broke --enable-symbols=all builds. See http://core.tcl.tk/tcl/tktview/a27ee06c65
Branch [bug-5d170b5ca5] is supposed to fix this [d58c269d4ed59281], currently being tested by Massimo Manghi. If those tests succeed, it will be merged to trunk
Fixed in core-8-5-branch and trunk now.