Subj : Re: Threading question - (50 bucs if you help me) To : netscape.public.mozilla.jseng From : nick.longinow@brio.com (Nick Longinow) Date : Tue Feb 18 2003 05:51 am Brendan Eich wrote in message news:<3E4D8989.3070100@meer.net>... > Nick Longinow wrote: > > >Just kidding on the 50 Ohio State Univ. players thing. > >Did it get you to read this ? Please help!! > > > >I have a single service that creates the JS engine, and > >then each user request that hits it creates its own > >runtime and context. I find that this works fine except > >for threads that hit at the roughly same time. > > > >Specifically, I AddRoot several items right after the > >context is created for a new thread, and shortly after > >do a MaybeGC. So far so good, as long as the threads > >hit far enough apart. > > > >But if they occur close enough together, then the > >gc_root_marker check will find that at least one of > >those items I did AddRoot on fail the check for > >root_points_to_gcArenaPool = JS_TRUE; > > > > That means the GC scanned a root you registed by its address and found > it contained a pointer (jsval or plain pointer) that did not point > within the GC heap. You either failed to initialize the root, or you > let it turn into garbage on the malloc heap (get recycled, and filled in > with new bits that did not form a valid GC-thing pointer) without first > unregistering the root with JS_RemoveRoot. > > /be > > > > >The 1.5 jsgc.c code has a comment that says this is due to > >some root not being removed properly. But, I am still > >using those objects, and so wouldn't *want* to do a > >remove root on them. > > > >Any ideas what the collision here is all about ? > > > > Makes sense. It looks like the new threads are trying to reinitialize roots that were already added, using static addresses. I'll modify them to non-static, and let the thread destructor properly remove them as roots. Thanks for the good description of this rooting mechanism. .