Closed Bug 1218900 Opened 4 years ago Closed 4 years ago

Assertion failure: phaseNestingDepth == 0, at gc/Statistics.cpp

Categories

(Core :: JavaScript Engine: JIT, defect, critical)

x86_64
macOS
defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox44 --- affected
firefox45 --- fixed

People

(Reporter: gkw, Assigned: jonco)

References

(Blocks 2 open bugs)

Details

(Keywords: assertion, regression, testcase, Whiteboard: [jsbugmon:update])

Attachments

(2 files)

readline = function() {};
// Adapted from randomly chosen test: js/src/jit-test/tests/basic/testGuardCalleeSneakAttack2.js
Function.prototype.toString = function() {
    for (var i = 0; i < 2; i++) {
        this()
    }
};
oomTest(getBacktrace({
    thisprops: true
}))

asserts js debug shell on m-c changeset d53a52b39a95 with --fuzzing-safe --no-threads --ion-eager at Assertion failure: phaseNestingDepth == 0, at gc/Statistics.cpp

Configure options:

CC="clang -Qunused-arguments" CXX="clang++ -Qunused-arguments" AR=ar AUTOCONF=/usr/local/Cellar/autoconf213/2.13/bin/autoconf213 sh /Users/skywalker/trees/mozilla-central/js/src/configure --target=x86_64-apple-darwin12.5.0 --enable-debug --disable-threadsafe --enable-more-deterministic --with-ccache --enable-gczeal --enable-debug-symbols --disable-tests

python -u ~/funfuzz/js/compileShell.py -b "--enable-debug --enable-more-deterministic" -r d53a52b39a95

autoBisect shows this is probably related to the following changeset:

The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/9c365490d4ce
user:        Jon Coppeard
date:        Tue Oct 13 13:37:07 2015 +0100
summary:     Bug 1212469 - Make oomTest() into a shell function r=nbp

Jon, is bug 1212469 a likely regressor?
Flags: needinfo?(jcoppeard)
Attached file stack
(lldb) bt 5
* thread #1: tid = 0x1f0ec4, 0x00000001008e40c4 js-dbg-64-dm-darwin-d53a52b39a95`js::gcstats::Statistics::startTimingMutator(this=<unavailable>) + 132 at Statistics.cpp:1024, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, address=0x0)
  * frame #0: 0x00000001008e40c4 js-dbg-64-dm-darwin-d53a52b39a95`js::gcstats::Statistics::startTimingMutator(this=<unavailable>) + 132 at Statistics.cpp:1024
    frame #1: 0x000000010000dbc2 js-dbg-64-dm-darwin-d53a52b39a95`StartTimingMutator(cx=<unavailable>, argc=<unavailable>, vp=0x00007fff5fbfcdc8) + 98 at js.cpp:1627
    frame #2: 0x0000000100676cb2 js-dbg-64-dm-darwin-d53a52b39a95`js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) [inlined] js::CallJSNative(cx=0x0000000102c45400, native=(js-dbg-64-dm-darwin-d53a52b39a95`StartTimingMutator(JSContext*, unsigned int, JS::Value*) at js.cpp:1619))(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) + 174 at jscntxtinlines.h:235
    frame #3: 0x0000000100676c04 js-dbg-64-dm-darwin-d53a52b39a95`js::Invoke(cx=0x0000000102c45400, args=0x00007fff5fbfcd70, construct=<unavailable>) + 596 at Interpreter.cpp:489
    frame #4: 0x000000010069c4fd js-dbg-64-dm-darwin-d53a52b39a95`js::Invoke(cx=0x0000000102c45400, thisv=0x00007fff5fbfcf58, fval=<unavailable>, argc=<unavailable>, argv=<unavailable>, rval=<unavailable>) + 669 at Interpreter.cpp:542
(lldb)
Blocks: 1100132
Not related to bug 1212469.  I can remove the call to oomTest() and still get the failure.

BTW making Function.prototype.toString call |this()| is really evil...
Blocks: 1088831
No longer blocks: 1212469
Flags: needinfo?(jcoppeard)
Patch to make Statistics::startTimingMutator() return false if called at the wrong time rather than asserting.
Assignee: nobody → jcoppeard
Attachment #8679941 - Flags: review?(sphink)
Comment on attachment 8679941 [details] [diff] [review]
bug1218900-mutator-timing

Review of attachment 8679941 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/gc/Statistics.cpp
@@ +1021,5 @@
>  Statistics::startTimingMutator()
>  {
> +    // Should only be called from outside of GC.
> +    if (phaseNestingDepth != 0)
> +        return false;

This bug shows that the comment is incorrect. The intention was to prevent mistakes where somehow startTimingMutator would be called from within a GC, which would mess up the phase nesting. But it's additionally guarding against nested invocations of itself. As in, this script shows the same crash:

  startTimingMutator();
  startTimingMutator();

So I think the right fix would be to change this to

  if (phaseNestingDepth != 0) {
    // Should only be called from outside of GC.
    MOZ_ASSERT(phaseNestingDepth == 1);
    MOZ_ASSERT(phaseNesting[0] == PHASE_MUTATOR);
    return false;
  }
Attachment #8679941 - Flags: review?(sphink) → review+
autoBisect shows this is probably related to the following changeset:

The first bad revision is:
changeset:   https://hg.mozilla.org/mozilla-central/rev/b261745c586a
user:        Steve Fink
date:        Tue Nov 18 11:26:11 2014 -0800
summary:     Bug 1088831 - Count storebuffer overflows, account for minor GCs, and implement timed regions, r=jonco

Yes, bug 1088831 does seem to be the regressor. (I bisected using a testcase without oomTest)
https://hg.mozilla.org/mozilla-central/rev/40fdcdc3dfbb
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
removing the b2g 2.5 flag since this commit has been reverted due to an incorrect merge, sorry for the confusion
Duplicate of this bug: 1136717
Duplicate of this bug: 1361269
You need to log in before you can comment on or make changes to this bug.