From: Vlad S. <vl...@cr...> - 2006-04-06 23:24:13
|
This is what i discovered yesterday, i ported my application from ns_cache module to internal Tcl cache API and got SEGV crashes. Under high concurrency when inside ns_cache_eval i call another ns_cache_set C cache API crashes, using ns_cache it was working the last couple of years. It always crashes in this place. Loaded symbols for /lib/libresolv.so.2 #0 Push (ePtr=0xa92ab878) at cache.c:904 904 ePtr->cachePtr->firstEntryPtr->prevPtr = ePtr; (gdb) bt #0 Push (ePtr=0xa92ab878) at cache.c:904 #1 0xb7f59cb5 in Ns_CacheWaitCreateEntry (cache=0x839e858, key=0x867fb98 "6", newPtr=0xabc3575c, timeout=360) at cache.c:295 #2 0xb7f79a5b in CreateEntry (itPtr=0x888bcf8, cache=0x839e858, key=0x867fb98 "6", newPtr=0x8a990000, timeout=360) at tclcache.c:686 #3 0xb7f7a01c in NsTclCacheSetObjCmd (arg=0x888bcf8, interp=0x88b5120, objc=-1969684480, objv=0x8a990000) at tclcache.c:367 #4 0xb7ea9143 in TclEvalObjvInternal (interp=0x88b5120, objc=4, objv=0x88c775c, command=0x0, length=0, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:3085 #5 0xb7ed2fa0 in TclExecuteByteCode (interp=0x88b5120, codePtr=0x891cb80) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecute.c:1419 #6 0xb7ed8ee8 in TclCompEvalObj (interp=0x88b5120, objPtr=0x888ec38) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecute.c:981 #7 0xb7eab94b in Tcl_EvalObjEx (interp=0x88b5120, objPtr=0x888ec38, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:4049 #8 0xb7f7a521 in NsTclCacheEvalObjCmd (arg=0x888bcf8, interp=0x88b5120, objc=6, objv=0x88c7744) at tclcache.c:167 #9 0xb7ea9143 in TclEvalObjvInternal (interp=0x88b5120, objc=6, objv=0x88c7744, command=0x0, length=0, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:3085 #10 0xb7ed2fa0 in TclExecuteByteCode (interp=0x88b5120, codePtr=0x89174e0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecute.c:1419 #11 0xb7ed8ee8 in TclCompEvalObj (interp=0x88b5120, objPtr=0x888f2f8) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecute.c:981 #12 0xb7eab94b in Tcl_EvalObjEx (interp=0x88b5120, objPtr=0x888f2f8, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:4049 #13 0xb7eb0dba in Tcl_ForObjCmd (dummy=0x0, interp=0x88b5120, objc=5, objv=0xabc362ac) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclCmdAH.c:1638 #14 0xb7ea9143 in TclEvalObjvInternal (interp=0x88b5120, objc=5, objv=0xabc362ac, command=0x840144f "for {set j 0} {$j < 1000} {incr j} {\n", ' ' <repeats 16 times>, "for {set x 0} {$x < 10000} {incr x} {set a b}\n", ' ' <repeats 16 times>, "ns_cache_eval -ttl 1 c1 k1 {\n", ' ' <repeats 18 times>, "ns_cache_set c1 $j $j\n", ' ' <repeats 16 times>..., length=276, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:3085 #15 0xb7eaace4 in Tcl_EvalEx (interp=0x88b5120, script=0x8401440 " \n", ' ' <repeats 12 times>, "for {set j 0} {$j < 1000} {incr j} {\n", ' ' <repeats 16 times>, "for {set x 0} {$x < 10000} {incr x} {set a b}\n", ' ' <repeats 16 times>, "ns_cache_eval -ttl 1 c1 k1 {\n", ' ' <repeats 18 times>, "ns_cache_set c1 $j $j\n "..., numBytes=299, flags=0) at /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic.c:3687 #16 0xb7f7f58e in Ns_TclEval (dsPtr=0x0, server=0x8a990000 <Address 0x8a990000 out of bounds>, script=0x8a990000 <Address 0x8a990000 out of bounds>) at tclinit.c:227 #17 0xb7f8c48f in NsTclThread (arg=0x8401438) at tclthread.c:660 #18 0xb7f3c524 in NsThreadMain (arg=0x82ac7e8) at thread.c:224 #19 0xb7f3d2dd in ThreadMain (arg=0x8a990000) at pthread.c:736 #20 0xb7cd5240 in start_thread () from /lib/tls/libpthread.so.0 Vlad Seryakov wrote: > Update of /cvsroot/naviserver/naviserver/tests > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27307 > > Modified Files: > ns_cache.test > Log Message: > Hard cache test which works in case of ns_cache modules but core dumps using ns_cache_eval > > > Index: ns_cache.test > =================================================================== > RCS file: /cvsroot/naviserver/naviserver/tests/ns_cache.test,v > retrieving revision 1.4 > retrieving revision 1.5 > diff -C2 -d -r1.4 -r1.5 > *** ns_cache.test 5 Apr 2006 18:24:57 -0000 1.4 > --- ns_cache.test 6 Apr 2006 23:20:44 -0000 1.5 > *************** > *** 300,304 **** > for {set j 0} {$j < 1000} {incr j} { > for {set x 0} {$x < 10000} {incr x} {set a b} > ! ns_cache_eval c1 k1 {return a} > ns_thread yield > } > --- 300,307 ---- > for {set j 0} {$j < 1000} {incr j} { > for {set x 0} {$x < 10000} {incr x} {set a b} > ! ns_cache_eval -ttl 1 c1 k1 { > ! ns_cache_set c1 $j $j > ! return a > ! } > ns_thread yield > } > *************** > *** 308,311 **** > --- 311,315 ---- > for {set j 0} {$j < 1000} {incr j} { > for {set x 0} {$x < 10000} {incr x} {set a b} > + ns_cache_get c1 $j > ns_cache_flush c1 > ns_thread yield > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > naviserver-commits mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-commits > -- Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Vlad S. <vl...@cr...> - 2006-04-13 22:56:48
|
But still make test crashes in #0 Push (ePtr=3D0x87ff938) at cache.c:904 904 ePtr->cachePtr->firstEntryPtr->prevPtr =3D ePtr; Stephen Deasey wrote: > Using Tcl 8.4.12. >=20 > Create the file tests/x.test: >=20 >=20 > package require tcltest 2.2 > namespace import -force ::tcltest::* >=20 > eval ::tcltest::configure $argv >=20 > test corruption-1 {cache incr highlights corruption} -setup { > ns_cache_create c1 1000 > } -body { > ns_cache_incr c1 k1 > ns_cache_incr c1 k1 > } -cleanup { > ns_cache_flush c1 > } -result 2 >=20 > cleanupTests >=20 >=20 >=20 > Run with: >=20 > make test TCLTESTARGS=3D"-file x.test" >=20 >=20 > You get an error like: >=20 > errorInfo: expected integer but got "1aaaaaaaaaaaaZa=A5aaa=069" >=20 > Hopefully Purify spots something. Thanks! >=20 >=20 >=20 > On 4/13/06, Zoran Vasiljevic <zv...@ar...> wrote: >> On 13.04.2006, at 23:58, Stephen Deasey wrote: >> >>> Unless anyone has any bright ideas, I'm going to test snapshots from >>> CVS until the problem goes away, when I get time... >>> >> I have Purify. Can you get me a sequence of commands >> which expose memory corrruption so I can replay it >> under purify control? >> >> Cheers >> Zoran >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting lan= guage >> that extends applications into web and mobile media. Attend the live w= ebcast >> and join the prime developer group breaking into this new coding terri= tory! >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&da= t=3D121642 >> _______________________________________________ >> naviserver-devel mailing list >> nav...@li... >> https://lists.sourceforge.net/lists/listinfo/naviserver-devel >> >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel >=20 --=20 Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Stephen D. <sd...@gm...> - 2006-04-13 23:12:17
|
Maybe I'm just confusing myself, but I thought that with a different configuration, THREAD_ALLOC enabled iirc, the error message was showing that it was reading one byte *before* the buffer, no just running off the end because of no NIL byte. Could be wrong though.=20 I'll take another look at the cache code. ns_adp_compress-1.2 is failing with one byte different on my new Fedore Core 5 machine as well... On 4/13/06, Vlad Seryakov <vl...@cr...> wrote: > But still make test crashes in > > #0 Push (ePtr=3D0x87ff938) at cache.c:904 > 904 ePtr->cachePtr->firstEntryPtr->prevPtr =3D ePtr; > > Stephen Deasey wrote: > > Using Tcl 8.4.12. > > > > Create the file tests/x.test: > > > > > > package require tcltest 2.2 > > namespace import -force ::tcltest::* > > > > eval ::tcltest::configure $argv > > > > test corruption-1 {cache incr highlights corruption} -setup { > > ns_cache_create c1 1000 > > } -body { > > ns_cache_incr c1 k1 > > ns_cache_incr c1 k1 > > } -cleanup { > > ns_cache_flush c1 > > } -result 2 > > > > cleanupTests > > > > > > > > Run with: > > > > make test TCLTESTARGS=3D"-file x.test" > > > > > > You get an error like: > > > > errorInfo: expected integer but got "1aaaaaaaaaaaaZa=A5aaa=069" > > > > Hopefully Purify spots something. Thanks! > > > > > > > > On 4/13/06, Zoran Vasiljevic <zv...@ar...> wrote: > >> On 13.04.2006, at 23:58, Stephen Deasey wrote: > >> > >>> Unless anyone has any bright ideas, I'm going to test snapshots from > >>> CVS until the problem goes away, when I get time... > >>> > >> I have Purify. Can you get me a sequence of commands > >> which expose memory corrruption so I can replay it > >> under purify control? > >> > >> Cheers > >> Zoran > >> > >> > >> ------------------------------------------------------- > >> This SF.Net email is sponsored by xPML, a groundbreaking scripting lan= guage > >> that extends applications into web and mobile media. Attend the live w= ebcast > >> and join the prime developer group breaking into this new coding terri= tory! > >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&da= t=3D121642 > >> _______________________________________________ > >> naviserver-devel mailing list > >> nav...@li... > >> https://lists.sourceforge.net/lists/listinfo/naviserver-devel > >> > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > > that extends applications into web and mobile media. Attend the live we= bcast > > and join the prime developer group breaking into this new coding territ= ory! > > http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 > > _______________________________________________ > > naviserver-devel mailing list > > nav...@li... > > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > > > > -- > Vlad Seryakov > 571 262-8608 office > vl...@cr... > http://www.crystalballinc.com/vlad/ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmdlnk&kid=110944&bid$1720&dat=121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Zoran V. <zv...@ar...> - 2006-04-14 12:23:37
|
On 14.04.2006, at 11:58, Zoran Vasiljevic wrote: > OK. This is the beast: > > test cache-6.2 {eval ttl} -body { > ns_cache_eval -ttl 1 -- c1 k1 {return a} > after 1500 > ns_cache_eval c1 k1 {return b} > } -cleanup { > ns_cache_flush c1 > } -result b It is now fixed in the CVS. Stephen please read the comment I put in the code. I do not know if this is really correct as it ignores the expired entry and just reuses it. OTOH, if I do it "right" i.e. purge then re-create, the test routine starts to throw errors. So it is either the test that is wrong or the API that is wrong. As it is in CVS now it works with the current test routine and does not crash. Admitently, expired entries are not expired at that place, rather re-used. Cheers Zoran |
From: Stephen D. <sd...@gm...> - 2006-04-15 23:07:49
|
On 4/14/06, Zoran Vasiljevic <zv...@ar...> wrote: > > On 14.04.2006, at 11:58, Zoran Vasiljevic wrote: > > > OK. This is the beast: > > > > test cache-6.2 {eval ttl} -body { > > ns_cache_eval -ttl 1 -- c1 k1 {return a} > > after 1500 > > ns_cache_eval c1 k1 {return b} > > } -cleanup { > > ns_cache_flush c1 > > } -result b > > It is now fixed in the CVS. Stephen please read > the comment I put in the code. I do not know if > this is really correct as it ignores the expired > entry and just reuses it. OTOH, if I do it "right" > i.e. purge then re-create, the test routine starts > to throw errors. So it is either the test that is > wrong or the API that is wrong. As it is in CVS now > it works with the current test routine and does not > crash. Admitently, expired entries are not expired > at that place, rather re-used. There were a couple of errors: a call to Ns_CacheFreeEntry() crept into ExpireEntry() when Ns_UnsetValue() was enough. Looks like a thinko, mirroring the code of PruneEntry() below it. Also, cache flushes were causing Ns_CacheWaitCreateEntry() to fail, which isn't what callers expect. The entry is just recreated in that case. I split the code between the two similar functions and it seems a lot clearer what's going on now. |
From: Stephen D. <sd...@gm...> - 2006-04-13 21:58:29
|
Uh oh... There could well be problems with the cache code, but I think it runs deeper than that. I've found a couple of problems which are easier to trigger, for testing: make runtest ns_info nsd ...produces garbage. make runtest ns_cache_create c 1000 ns_cache_incr c k 1 ns_cache_create c k ...produces an error. Memory corruption. Looking a little deeper, I don't see how the first ever passed it's test. nsconf.nsd end up pointing to heap memory, allocated by Tcl.=20 But the Tcl function is called twice (don't have it in front of me, FindExecutable?), and the second time it frees and then allocates a buffer for the path again, so the original nsconf.nsd is pointing at deallocated memory. Easy to fix, but puzzling why this didn't show up before. The code for ns_cache_incr looks reasonable. The error seems to happen in the Tcl core when it tries to parse the cache value as an integer by using the regexp engine. I think by this point memory is already trashed. Whatever is trashing memory it's happening really early. I tried with only one virtual server configured, tried using the control port instead of the built in command shell etc. but it's still there. I've also tried running with Tcl mem debugging enabled, thread allocator disabled, Linux MALLOC_CHECK_ enabled -- no joy. The bad news is that I noticed something months ago. I tried linking against a Tcl 8.5 snapshot from CVS and the test suite crashed it every time. I thought it was just an unstable Tcl. Unless anyone has any bright ideas, I'm going to test snapshots from CVS until the problem goes away, when I get time... On 4/7/06, Vlad Seryakov <vl...@cr...> wrote: > This is what i discovered yesterday, i ported my application from > ns_cache module to internal Tcl cache API and got SEGV crashes. Under > high concurrency when inside ns_cache_eval i call another ns_cache_set C > cache API crashes, using ns_cache it was working the last couple of > years. It always crashes in this place. > > Loaded symbols for /lib/libresolv.so.2 > #0 Push (ePtr=3D0xa92ab878) at cache.c:904 > 904 ePtr->cachePtr->firstEntryPtr->prevPtr =3D ePtr; > (gdb) bt > #0 Push (ePtr=3D0xa92ab878) at cache.c:904 > #1 0xb7f59cb5 in Ns_CacheWaitCreateEntry (cache=3D0x839e858, > key=3D0x867fb98 "6", newPtr=3D0xabc3575c, timeout=3D360) at cache.c:295 > #2 0xb7f79a5b in CreateEntry (itPtr=3D0x888bcf8, cache=3D0x839e858, > key=3D0x867fb98 "6", newPtr=3D0x8a990000, timeout=3D360) > at tclcache.c:686 > #3 0xb7f7a01c in NsTclCacheSetObjCmd (arg=3D0x888bcf8, interp=3D0x88b512= 0, > objc=3D-1969684480, objv=3D0x8a990000) at tclcache.c:367 > #4 0xb7ea9143 in TclEvalObjvInternal (interp=3D0x88b5120, objc=3D4, > objv=3D0x88c775c, command=3D0x0, length=3D0, flags=3D0) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:3085 > #5 0xb7ed2fa0 in TclExecuteByteCode (interp=3D0x88b5120, codePtr=3D0x891= cb80) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecu= te.c:1419 > #6 0xb7ed8ee8 in TclCompEvalObj (interp=3D0x88b5120, objPtr=3D0x888ec38) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecu= te.c:981 > #7 0xb7eab94b in Tcl_EvalObjEx (interp=3D0x88b5120, objPtr=3D0x888ec38, > flags=3D0) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:4049 > #8 0xb7f7a521 in NsTclCacheEvalObjCmd (arg=3D0x888bcf8, interp=3D0x88b51= 20, > objc=3D6, objv=3D0x88c7744) at tclcache.c:167 > #9 0xb7ea9143 in TclEvalObjvInternal (interp=3D0x88b5120, objc=3D6, > objv=3D0x88c7744, command=3D0x0, length=3D0, flags=3D0) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:3085 > #10 0xb7ed2fa0 in TclExecuteByteCode (interp=3D0x88b5120, codePtr=3D0x891= 74e0) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecu= te.c:1419 > #11 0xb7ed8ee8 in TclCompEvalObj (interp=3D0x88b5120, objPtr=3D0x888f2f8) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclExecu= te.c:981 > #12 0xb7eab94b in Tcl_EvalObjEx (interp=3D0x88b5120, objPtr=3D0x888f2f8, > flags=3D0) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:4049 > #13 0xb7eb0dba in Tcl_ForObjCmd (dummy=3D0x0, interp=3D0x88b5120, objc=3D= 5, > objv=3D0xabc362ac) > at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclCmdAH= .c:1638 > #14 0xb7ea9143 in TclEvalObjvInternal (interp=3D0x88b5120, objc=3D5, > objv=3D0xabc362ac, > command=3D0x840144f "for {set j 0} {$j < 1000} {incr j} {\n", ' ' > <repeats 16 times>, "for {set x 0} {$x < 10000} {incr x} {set a b}\n", ' > ' <repeats 16 times>, "ns_cache_eval -ttl 1 c1 k1 {\n", ' ' <repeats 18 > times>, "ns_cache_set c1 $j $j\n", ' ' <repeats 16 times>..., > length=3D276, flags=3D0) at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:3085 > #15 0xb7eaace4 in Tcl_EvalEx (interp=3D0x88b5120, > script=3D0x8401440 " \n", ' ' <repeats 12 times>, "for {set j 0} {$= j > < 1000} {incr j} {\n", ' ' <repeats 16 times>, "for {set x 0} {$x < > 10000} {incr x} {set a b}\n", ' ' <repeats 16 times>, "ns_cache_eval > -ttl 1 c1 k1 {\n", ' ' <repeats 18 times>, "ns_cache_set c1 $j $j\n > "..., numBytes=3D299, flags=3D0) at > /home/vlad/src/lmbox/linux/src/tcl/src/tcl8.4.12/unix/../generic/tclBasic= .c:3687 > #16 0xb7f7f58e in Ns_TclEval (dsPtr=3D0x0, server=3D0x8a990000 <Address > 0x8a990000 out of bounds>, > script=3D0x8a990000 <Address 0x8a990000 out of bounds>) at tclinit.c= :227 > #17 0xb7f8c48f in NsTclThread (arg=3D0x8401438) at tclthread.c:660 > #18 0xb7f3c524 in NsThreadMain (arg=3D0x82ac7e8) at thread.c:224 > #19 0xb7f3d2dd in ThreadMain (arg=3D0x8a990000) at pthread.c:736 > #20 0xb7cd5240 in start_thread () from /lib/tls/libpthread.so.0 > > > Vlad Seryakov wrote: > > Update of /cvsroot/naviserver/naviserver/tests > > In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27307 > > > > Modified Files: > > ns_cache.test > > Log Message: > > Hard cache test which works in case of ns_cache modules but core dumps = using ns_cache_eval > > > > > > Index: ns_cache.test > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > RCS file: /cvsroot/naviserver/naviserver/tests/ns_cache.test,v > > retrieving revision 1.4 > > retrieving revision 1.5 > > diff -C2 -d -r1.4 -r1.5 > > *** ns_cache.test 5 Apr 2006 18:24:57 -0000 1.4 > > --- ns_cache.test 6 Apr 2006 23:20:44 -0000 1.5 > > *************** > > *** 300,304 **** > > for {set j 0} {$j < 1000} {incr j} { > > for {set x 0} {$x < 10000} {incr x} {set a b} > > ! ns_cache_eval c1 k1 {return a} > > ns_thread yield > > } > > --- 300,307 ---- > > for {set j 0} {$j < 1000} {incr j} { > > for {set x 0} {$x < 10000} {incr x} {set a b} > > ! ns_cache_eval -ttl 1 c1 k1 { > > ! ns_cache_set c1 $j $j > > ! return a > > ! } > > ns_thread yield > > } > > *************** > > *** 308,311 **** > > --- 311,315 ---- > > for {set j 0} {$j < 1000} {incr j} { > > for {set x 0} {$x < 10000} {incr x} {set a b} > > + ns_cache_get c1 $j > > ns_cache_flush c1 > > ns_thread yield > > > > > > > > ------------------------------------------------------- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > > that extends applications into web and mobile media. Attend the live we= bcast > > and join the prime developer group breaking into this new coding territ= ory! > > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > > _______________________________________________ > > naviserver-commits mailing list > > nav...@li... > > https://lists.sourceforge.net/lists/listinfo/naviserver-commits > > > > -- > Vlad Seryakov > 571 262-8608 office > vl...@cr... > http://www.crystalballinc.com/vlad/ > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Zoran V. <zv...@ar...> - 2006-04-13 22:03:41
|
On 13.04.2006, at 23:58, Stephen Deasey wrote: > Unless anyone has any bright ideas, I'm going to test snapshots from > CVS until the problem goes away, when I get time... > I have Purify. Can you get me a sequence of commands which expose memory corrruption so I can replay it under purify control? Cheers Zoran |
From: Stephen D. <sd...@gm...> - 2006-04-13 22:30:47
|
Using Tcl 8.4.12. Create the file tests/x.test: package require tcltest 2.2 namespace import -force ::tcltest::* eval ::tcltest::configure $argv test corruption-1 {cache incr highlights corruption} -setup { ns_cache_create c1 1000 } -body { ns_cache_incr c1 k1 ns_cache_incr c1 k1 } -cleanup { ns_cache_flush c1 } -result 2 cleanupTests Run with: make test TCLTESTARGS=3D"-file x.test" You get an error like: errorInfo: expected integer but got "1aaaaaaaaaaaaZa=A5aaa=069" Hopefully Purify spots something. Thanks! On 4/13/06, Zoran Vasiljevic <zv...@ar...> wrote: > > On 13.04.2006, at 23:58, Stephen Deasey wrote: > > > Unless anyone has any bright ideas, I'm going to test snapshots from > > CVS until the problem goes away, when I get time... > > > > I have Purify. Can you get me a sequence of commands > which expose memory corrruption so I can replay it > under purify control? > > Cheers > Zoran > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting langua= ge > that extends applications into web and mobile media. Attend the live webc= ast > and join the prime developer group breaking into this new coding territor= y! > http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&dat= =3D121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel > |
From: Vlad S. <vl...@cr...> - 2006-04-13 22:54:40
|
My fault, commiting the fix Stephen Deasey wrote: > Using Tcl 8.4.12. >=20 > Create the file tests/x.test: >=20 >=20 > package require tcltest 2.2 > namespace import -force ::tcltest::* >=20 > eval ::tcltest::configure $argv >=20 > test corruption-1 {cache incr highlights corruption} -setup { > ns_cache_create c1 1000 > } -body { > ns_cache_incr c1 k1 > ns_cache_incr c1 k1 > } -cleanup { > ns_cache_flush c1 > } -result 2 >=20 > cleanupTests >=20 >=20 >=20 > Run with: >=20 > make test TCLTESTARGS=3D"-file x.test" >=20 >=20 > You get an error like: >=20 > errorInfo: expected integer but got "1aaaaaaaaaaaaZa=A5aaa=069" >=20 > Hopefully Purify spots something. Thanks! >=20 >=20 >=20 > On 4/13/06, Zoran Vasiljevic <zv...@ar...> wrote: >> On 13.04.2006, at 23:58, Stephen Deasey wrote: >> >>> Unless anyone has any bright ideas, I'm going to test snapshots from >>> CVS until the problem goes away, when I get time... >>> >> I have Purify. Can you get me a sequence of commands >> which expose memory corrruption so I can replay it >> under purify control? >> >> Cheers >> Zoran >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by xPML, a groundbreaking scripting lan= guage >> that extends applications into web and mobile media. Attend the live w= ebcast >> and join the prime developer group breaking into this new coding terri= tory! >> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D110944&bid=3D241720&da= t=3D121642 >> _______________________________________________ >> naviserver-devel mailing list >> nav...@li... >> https://lists.sourceforge.net/lists/listinfo/naviserver-devel >> >=20 >=20 > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting lang= uage > that extends applications into web and mobile media. Attend the live we= bcast > and join the prime developer group breaking into this new coding territ= ory! > http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642 > _______________________________________________ > naviserver-devel mailing list > nav...@li... > https://lists.sourceforge.net/lists/listinfo/naviserver-devel >=20 --=20 Vlad Seryakov 571 262-8608 office vl...@cr... http://www.crystalballinc.com/vlad/ |
From: Zoran V. <zv...@ar...> - 2006-04-14 09:10:31
|
On 14.04.2006, at 00:30, Stephen Deasey wrote: > Using Tcl 8.4.12. > > Create the file tests/x.test: > > > package require tcltest 2.2 > namespace import -force ::tcltest::* > > eval ::tcltest::configure $argv > > test corruption-1 {cache incr highlights corruption} -setup { > ns_cache_create c1 1000 > } -body { > ns_cache_incr c1 k1 > ns_cache_incr c1 k1 > } -cleanup { > ns_cache_flush c1 > } -result 2 > > cleanupTests > > > > Run with: > > make test TCLTESTARGS=3D"-file x.test" > > > You get an error like: > > errorInfo: expected integer but got "1aaaaaaaaaaaaZa=A5aaa=069" > > Hopefully Purify spots something. Thanks! > Unable to get Purify running with the test env, therefore I just did the above commands from within the control port session: lexxsrv:nscp 1> ns_cache_create c1 1000 lexxsrv:nscp 2> ns_cache_incr c1 k1 1 lexxsrv:nscp 3> ns_cache_incr c1 k1 2 lexxsrv:nscp 4> ns_cache_flush c1 1 Purify observes no memory violation and all is fine. I can repeat the above 1000's of times w/o any side effect. I'm running against freshly checked-out code and with Tcl 8.4.12. Is there any other test which would reveal the corruption? Cheers Zoran |
From: Zoran V. <zv...@ar...> - 2006-04-14 09:25:29
|
On 14.04.2006, at 11:10, Zoran Vasiljevic wrote: > Unable to get Purify running with the test env, therefore > I just did the above commands from within the control port > session: > > lexxsrv:nscp 1> ns_cache_create c1 1000 > > lexxsrv:nscp 2> ns_cache_incr c1 k1 > 1 > lexxsrv:nscp 3> ns_cache_incr c1 k1 > 2 > lexxsrv:nscp 4> ns_cache_flush c1 > 1 > > Purify observes no memory violation and all is fine. > I can repeat the above 1000's of times w/o any side > effect. > I'm running against freshly checked-out code > and with Tcl 8.4.12. Is there any other test > which would reveal the corruption? I have seen that tests/ns_crypt.test cores the process. Although, when I disable ns_cache test, it goes fine. Presumably, something is really wrong in the cache code, I will try to run (I have to yet figure out how) the cache tests from the control port under purify control. Lets see if this reveals anything... Cheers Zoran |
From: Zoran V. <zv...@ar...> - 2006-04-14 09:35:43
|
On 14.04.2006, at 11:25, Zoran Vasiljevic wrote: > Lets see if this reveals anything... > Hm.... This code is pretty broken: FMR: Free memory read FMW: Free memory write FMR: Free memory read FMW: Free memory write FMR: Free memory read FMR: Free memory read FMR: Free memory read FMW: Free memory write FMW: Free memory write (4 times) FMW: Free memory write (3 times) ABW: Array bounds write (4 times) ABW: Array bounds write ABW: Array bounds write FMW: Free memory write (2 times) FMW: Free memory write ABW: Array bounds write (2 times) ABW: Array bounds write ABW: Array bounds write (2 times) ABW: Array bounds write FMW: Free memory write (2 times) FMW: Free memory write FMW: Free memory write FMW: Free memory write FMW: Free memory write We are funking all over the place. Now I have to isolate the test which triggers the error. This will be a long work as I have to disable test per test, reboot the server (takes long time under purify) and repeat... Zoran |
From: Zoran V. <zv...@ar...> - 2006-04-14 09:58:22
|
On 14.04.2006, at 11:35, Zoran Vasiljevic wrote: > We are funking all over the place. Now I have to > isolate the test which triggers the error. This > will be a long work as I have to disable test per > test, reboot the server (takes long time under purify) > and repeat... OK. This is the beast: test cache-6.2 {eval ttl} -body { ns_cache_eval -ttl 1 -- c1 k1 {return a} after 1500 ns_cache_eval c1 k1 {return b} } -cleanup { ns_cache_flush c1 } -result b It immediately results in the series of invalid writes and reads. I will have to isolate this in detail but here is the breakdown of Purify: FMR: Free memory read This is occurring while in thread 13: Push [cache.c:903] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Reading 4 bytes from 0x15c2dd8 in the heap. Address 0x15c2dd8 is 8 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMW: Free memory write This is occurring while in thread 13: Push [cache.c:906] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Writing 4 bytes to 0x15c2dd4 in the heap. Address 0x15c2dd4 is 4 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMR: Free memory read This is occurring while in thread 13: Push [cache.c:907] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Reading 4 bytes from 0x15c2dd8 in the heap. Address 0x15c2dd8 is 8 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMW: Free memory write This is occurring while in thread 13: Push [cache.c:907] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Writing 4 bytes to 0x15c2dd0 in the heap. Address 0x15c2dd0 is at the beginning of a freed block of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMR: Free memory read This is occurring while in thread 13: Push [cache.c:908] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Reading 4 bytes from 0x15c2dd8 in the heap. Address 0x15c2dd8 is 8 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMR: Free memory read This is occurring while in thread 13: Push [cache.c:909] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Reading 4 bytes from 0x15c2dd8 in the heap. Address 0x15c2dd8 is 8 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMR: Free memory read This is occurring while in thread 13: Push [cache.c:910] Ns_CacheWaitCreateEntry [cache.c:295] CreateEntry [tclcache.c:686] NsTclCacheEvalObjCmd [tclcache.c:158] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Reading 4 bytes from 0x15c2dd8 in the heap. Address 0x15c2dd8 is 8 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 0 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMW: Free memory write This is occurring while in thread 13: Push [cache.c:904] Ns_CacheWaitCreateEntry [cache.c:295] Ns_CacheCreateEntry [cache.c:244] NsTclCacheEvalObjCmd [tclcache.c:172] TclEvalObjvInternal [tclBasic.c:3085] Tcl_EvalEx [tclBasic.c:3687] Writing 4 bytes to 0x15c2dd4 in the heap. Address 0x15c2dd4 is 4 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 1 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] FMW: Free memory write This is occurring while in thread 13: Delink [cache.c:875] Ns_CacheDeleteEntry [cache.c:487] Ns_CacheFlushEntry [cache.c:517] Ns_CacheFlush [cache.c:548] NsTclCacheFlushObjCmd [tclcache.c:587] TclEvalObjvInternal [tclBasic.c:3085] Writing 4 bytes to 0x15c2dd4 in the heap. Address 0x15c2dd4 is 4 bytes into a freed block at 0x15c2dd0 of 32 bytes. This block was allocated from thread 13: malloc [rtlib.o] TclpAlloc [tclAlloc.c:679] Tcl_Alloc [tclCkalloc.c:1002] ns_malloc [memory.c:67] ns_calloc [memory.c:85] Ns_CacheWaitCreateEntry [cache.c:260] There have been 23 frees since this block was freed from thread 13: free [rtlib.o] TclpFree [tclAlloc.c:702] Tcl_Free [tclCkalloc.c:1160] ns_free [memory.c:74] Ns_CacheDeleteEntry [cache.c:489] ExpireEntry [cache.c:937] |