Closed
Bug 658016
Opened 14 years ago
Closed 14 years ago
TI: Crash [@ JSString::isStaticAtom()]
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
People
(Reporter: decoder, Assigned: igor)
References
Details
(Keywords: crash, testcase, Whiteboard: fixed-in-tracemonkey)
Crash Data
Attachments
(2 files, 1 obsolete file)
3.58 KB,
application/x-compressed-tar
|
Details | |
14.21 KB,
patch
|
billm
:
review+
|
Details | Diff | Splinter Review |
The attached testcase crashes on TI revision 97f9e3274bd5 (run main.js with -j -m -a), tested on 64 bit.
Backtrace:
==12185== Invalid read of size 8
==12185== at 0x46ED10: JSString::isStaticAtom() const (jsstr.h:367)
==12185== by 0x4CCF38: js::gc::MarkId(JSTracer*, jsid) (jsgcmark.cpp:252)
==12185== by 0x4CCFDA: js::gc::MarkId(JSTracer*, jsid, char const*) (jsgcmark.cpp:263)
==12185== by 0x4CE33F: js::gc::MarkChildren(JSTracer*, js::Shape const*) (jsgcmark.cpp:653)
==12185== by 0x4CE62C: JS_TraceChildren (jsgcmark.cpp:719)
==12185== by 0x42D8E5: JS_DumpHeap (jsapi.cpp:2554)
==12185== by 0x40C21D: DumpHeap(JSContext*, unsigned int, jsval_layout*) (js.cpp:2730)
==12185== by 0x4F342D: js::CallJSNative(JSContext*, int (*)(JSContext*, unsigned int, js::Value*), unsigned int, js::Value*) (jscntxtinlines.h:293)
==12185== by 0x716966: CallCompiler::generateNativeStub() (MonoIC.cpp:839)
==12185== by 0x7114FE: js::mjit::ic::NativeCall(js::VMFrame&, js::mjit::ic::CallICInfo*) (MonoIC.cpp:1108)
==12185== by 0x41B3F82: ???
==12185== by 0x691BC0: js::mjit::EnterMethodJIT(JSContext*, js::StackFrame*, void*, js::Value*) (MethodJIT.cpp:882)
==12185== Address 0x0 is not stack'd, malloc'd or (recently) free'd
==12185==
==12185==
==12185== Process terminating with default action of signal 11 (SIGSEGV)
Comment 1•14 years ago
|
||
TM bug, JS_DumpHeap calls TraceRuntime which invokes the conservative GC without first purging the compartment's freelists. This causes the conservative GC to think an object is live when it has not been allocated yet, and we crash.
This is I think a regression from bug 601234. Igor, do you mind looking at this?
Comment 2•14 years ago
|
||
That sounds vaguely like Bug 652985, though that was before bug 601234, so it couldn't have been caused by that.
Assignee | ||
Updated•14 years ago
|
Assignee: general → igor
Assignee | ||
Comment 3•14 years ago
|
||
The patch adds a helper class that temporary copies the free list to the arena and then clears the arenas again in the destructor. Its instance in TraceRuntime ensures that the conservative scanner can safely access the free list when dumping the arenas.
Another fix is the call to gcHelperThread.waitBackgroundSweepEnd before tracing the heap. Without that the conservative scanner may access just finalized things.
Attachment #533853 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 4•14 years ago
|
||
Here is an update in view of bug 658137 landing. The new patch uses AutoCopyFreeListToArenas in IterateCells to remove the free list checks in IterateArenaCells.
IterateCells also has a bug with missing RecordNativeStackTopForGC. This is important if AutoSession would wait for another GC to finish. To make sure that this would not happen in future I have added the call to LetOtherGCFinish where it should have been put long time ago.
Attachment #533853 -
Attachment is obsolete: true
Attachment #533853 -
Flags: review?(wmccloskey)
Attachment #534004 -
Flags: review?(wmccloskey)
Comment on attachment 534004 [details] [diff] [review]
v2
Review of attachment 534004 [details] [diff] [review]:
-----------------------------------------------------------------
Now I understand the reason for RecordNativeStackTopForGC. Thanks.
::: js/src/jsgc.cpp
@@ -2717,5 @@
> - /* -16k because it is possible to perform a GC during an overrecursion report. */
> - JS_ASSERT_IF(cx->stackLimit, JS_CHECK_STACK_SIZE(cx->stackLimit - (1 << 14), &stackDummy));
> -# endif
> -#endif
> -
I'm glad to see this go.
::: js/src/jsgc.h
@@ +750,5 @@
> + }
> + }
> +
> + /*
> + * Copy temporary the free list heads to the arenas so the code can see
"Temporarily copy"
@@ +764,5 @@
> + }
> + }
> +
> + /*
> + * Clear the free lists in arenas that were temporary set there using
"temporarily"
Comment on attachment 534004 [details] [diff] [review]
v2
Review of attachment 534004 [details] [diff] [review]:
-----------------------------------------------------------------
Now I understand the reason for RecordNativeStackTopForGC. Thanks.
::: js/src/jsgc.cpp
@@ -2717,5 @@
> - /* -16k because it is possible to perform a GC during an overrecursion report. */
> - JS_ASSERT_IF(cx->stackLimit, JS_CHECK_STACK_SIZE(cx->stackLimit - (1 << 14), &stackDummy));
> -# endif
> -#endif
> -
I'm glad to see this go.
::: js/src/jsgc.h
@@ +750,5 @@
> + }
> + }
> +
> + /*
> + * Copy temporary the free list heads to the arenas so the code can see
"Temporarily copy"
@@ +764,5 @@
> + }
> + }
> +
> + /*
> + * Clear the free lists in arenas that were temporary set there using
"temporarily"
Attachment #534004 -
Flags: review?(wmccloskey) → review+
Assignee | ||
Comment 7•14 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Assignee | ||
Comment 8•14 years ago
|
||
Christian: could you test that the landed patch fixes the test case? I cannot reproduce it on my box even if the problem from the comment 1 is real.
Comment 9•14 years ago
|
||
It looks like non-THREADSAFE builds are burning, TraceRuntime uses 'rt' without defining it first.
Assignee | ||
Comment 10•14 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/57412df720cf - followup to fix !JS_THREADSAFE builds.
Reporter | ||
Comment 11•14 years ago
|
||
Igor: The original test in comment 1 is for the JM branch. So to verify this fix, I need the changes pushed on the JM branch as well. It's likely that the test will not repro on TM at all, even if the underlying problem is in TM.
Comment 12•14 years ago
|
||
cdleary-bot mozilla-central merge info:
http://hg.mozilla.org/mozilla-central/rev/0e2d15573f6c
http://hg.mozilla.org/mozilla-central/rev/57412df720cf
Updated•14 years ago
|
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 13•14 years ago
|
||
I retested this on TI tip and it does no longer reproduce now :)
Assignee | ||
Comment 14•14 years ago
|
||
(In reply to comment #13)
> I retested this on TI tip and it does no longer reproduce now :)
Thanks!
Updated•13 years ago
|
Crash Signature: [@ JSString::isStaticAtom()]
You need to log in
before you can comment on or make changes to this bug.
Description
•