Subj : Re: automatic variable that holds JSAtom* in JS_DefineFunction() To : itaj sherman From : Brendan Eich Date : Sun Mar 09 2003 11:32 am itaj sherman wrote: >i tried the patch, and it solves this specific case, but other cases i >described in the previous post "SpiderMonkey crashes on invalid JSAtom*" >still occur. > That sounds like a different bug, then. >that is: the program runs 5 threads that run the main JS script in a loop. >the main script invokes a native function that compiles and executes another >script. >there's also a GC thread that calls JS_GC() once every second. >after a short while it will crash while executing the inner script trying to >use an invalid JSAtom* read from the bytecode. > What's an "inner script"? Sorry if I missed it in a previous post. If you are compiling while the GC thread tries to run, you still should be safe, because the compile disables the GC. But as a workaround and to test things, you might try changing your JS_GC call to js_GC (you'll have to include jsgc.h) and pass the GC_KEEP_ATOMS flag. >even if the inner script only defines a function and does nothing else it >crashes in js_Interpert() JSOP_DEFFUN. > What roots the inner script? Do you make a script object for it and root a pointer to that object, or a jsval referring to it (or otherwise protect, e.g., via JS_LockGCThing)? >i wanted to send you that testing program - i started making the changes in >the code so it works with NSPR thread API instead of our regular library. if >you need it i can finish it tomorrow and send it. > Please send any testing program, now and when you've finished the NSPR port. /be > >thanks >itaj > > > > > .