Artifacts Associated With Ticket 57945b574a6df033
Ticket change [e6da8733ba] (rid 141516) by gustafn on 2015-04-09 16:16:28:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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 (
- foundin initialized to: "8.5.17"
- is_private initialized to: "0"
- login: "gustafn"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- severity initialized to: "Important"
- status initialized to: "Open"
- submitter initialized to: "gustafn"
- subsystem initialized to: "01. Notifier"
- title initialized to: "lock in forking process under heay multithreading"
- type initialized to: "Bug"
Ticket change [daf74dfc79] (rid 141524) by mistachkin on 2015-04-09 19:57:43:
- icomment:
Candidate fix on associated branch. Basically, the "fix" here is to avoid finalizing a locked mutex *while* preventing other threads from grabbing it.
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [c7b8730c26] (rid 141525) by mistachkin on 2015-04-09 23:08:56:
- icomment:
Ideally, this fix should be applied to both 8.5 and 8.6.
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [da5c8ef15c] (rid 141797) by dkf on 2015-05-16 06:17:39:
- icomment: "See [30dc11630f2365d2]"
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- priority changed to: "9 Immediate"
- username: "dkf"
Ticket change [64ca2961f2] (rid 141798) by dkf on 2015-05-16 06:23:02:
- assignee changed to: "dkf"
- icomment:
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.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- username: "dkf"
Ticket change [549ed2d3d5] (rid 141802) by mistachkin on 2015-05-16 06:50:07:
- icomment: "Draft of doc changes now on branch."
- login: "mistachkin"
- mimetype: "text/plain"
Ticket change [955a2addb5] (rid 141803) by mistachkin on 2015-05-16 06:51:06:
- icomment:
I hereby formally request "fast-track" TIP approval for the next patch releases of 8.5.x and 8.6.x... :)
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [7a5f972d92] (rid 141807) by dkf on 2015-05-16 13:47:55:
- icomment:
TIP is now in. I'll request an immediate review and vote ASAP.
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [f27437e7da] (rid 141808) by dkf on 2015-05-16 13:49:30:
- icomment:
<a href="http://www.tcl.tk/cgi-bin/tct/tip/435.html">TIP #435</a>.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- username: "dkf"
- icomment:
Ticket change [1aa437b3d1] (rid 141809) by mistachkin on 2015-05-16 23:11:12:
- icomment:
We really should backport this to 8.5 as well; otherwise, they'll have to just live with this bug.
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [07e2005d2f] (rid 141810) by dkf on 2015-05-17 11:02:25:
- icomment:
Without exposing as a public API, for sure. I'm less certain about making it public, though I suppose it could go in <tt>tclInt.decls</tt> 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(?).)
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [5aa21c2442] (rid 141846) by mistachkin on 2015-05-18 01:57:25:
- icomment:
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.
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [07cc45d929] (rid 141856) by gustafn on 2015-05-18 09:41:00:
- icomment:
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!
- login: "gustafn"
- mimetype: "text/plain"
- icomment:
Ticket change [bd05425641] (rid 141861) by mistachkin on 2015-05-18 18:26:51:
- icomment:
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.
- login: "mistachkin"
- mimetype: "text/plain"
- icomment:
Ticket change [d85239c5c9] (rid 141872) by gustafn on 2015-05-18 21:02:39:
- icomment:
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...
- login: "gustafn"
- mimetype: "text/plain"
- icomment:
Ticket change [00d94f60aa] (rid 142007) by gustafn on 2015-06-08 10:57:54:
- icomment:
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.
- login: "gustafn"
- mimetype: "text/plain"
- icomment:
Ticket change [4a5cbe049f] (rid 142008) by gustafn on 2015-06-08 10:59:39:
- icomment:
... to be clear: i was testing with the version of the "experimental" branch.
- login: "gustafn"
- mimetype: "text/plain"
- icomment:
Ticket change [d7728353c4] (rid 142481) by dkf on 2015-07-13 12:56:26:
- login: "dkf"
- mimetype: "text/plain"
- title changed to: "lock in forking process under heavy multithreading"
Ticket change [bd8a5510f9] (rid 142583) by jan.nijtmans on 2015-07-23 17:11:06:
- assignee changed to: "jan.nijtmans"
- closedate changed to: "2457227.21604554"
- closer changed to: "jan.nijtmans"
- icomment: "Fixed in core-8-5-branch and trunk"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [525dca24aa] (rid 143169) by dgp on 2015-09-23 12:08:25:
- closer changed to: "nobody"
- icomment:
This patch completely broke --enable-symbols=all builds. See http://core.tcl.tk/tcl/tktview/a27ee06c65
- login: "dgp"
- mimetype: "text/plain"
- status changed to: "Open"
Ticket change [6429a791a6] (rid 143172) by jan.nijtmans on 2015-09-23 12:21:07:
- icomment:
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
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- icomment:
Ticket change [d3067b6188] (rid 143211) by jan.nijtmans on 2015-09-24 11:19:26:
- closedate changed to: "2457289.97183692"
- closer changed to: "jan.nijtmans"
- icomment: "Fixed in core-8-5-branch and trunk now."
- login: "jan.nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"