Closed Bug 1094392 Opened 7 years ago Closed 7 years ago

test-page-mod frequently times out

Categories

(Add-on SDK Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mossop, Unassigned)

References

Details

Attachments

(2 files)

46 bytes, text/x-github-pull-request
Details | Review
46 bytes, text/x-github-pull-request
zombie
: review+
Details | Review
Looks like an exception is getting thrown from the observer service shim for removeObserver.

An exception occurred.
Traceback (most recent call last):
  File "resource://extensions.modules.12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack.commonjs.path/sdk/timers.js", line 40, in notify
    callback.apply(null, args);
  File "resource://12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack/addon-sdk/tests/test-page-mod.js", line 1523, in exports.testDebugMetadata/mods<
    done();
  File "resource://12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack/addon-sdk/tests/pagemod-test-helpers.js", line 47, in testPageMod/onPageLoad/<
    pageMods.forEach(function(mod) mod.destroy());
  File "self-hosted", line 200, in forEach
  File "resource://12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack/addon-sdk/tests/pagemod-test-helpers.js", line 47, in testPageMod/onPageLoad/</<
    pageMods.forEach(function(mod) mod.destroy());
  File "resource://extensions.modules.12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack.commonjs.path/sdk/core/disposable.js", line 75, in Disposable<.destroy
    disposeDisposable(this);
  File "resource://extensions.modules.12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack.commonjs.path/sdk/core/disposable.js", line 58, in disposeDisposable
    unsubscribe(disposable, addonUnloadTopic);
  File "resource://extensions.modules.12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack.commonjs.path/method/core.js", line 119, in dispatch
    return method.apply(method, arguments)
  File "resource://extensions.modules.12b532e9-839f-444b-b1a5-c3857a0e5d55-at-jetpack.commonjs.path/sdk/core/observer.js", line 85, in null
    removeObserver(delegee, topic);
  File "resource://gre/components/multiprocessShims.js", line 133, in AddonInterpositionService.prototype.interpose/desc.value
    return interp.methods[prop](addon, target, ...args);
  File "resource://gre/modules/RemoteAddonsParent.jsm", line 344, in ObserverInterposition.methods.removeObserver
    target.removeObserver(observer, topic);
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIObserverService.removeObserver]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: resource://gre/modules/RemoteAddonsParent.jsm :: ObserverInterposition.methods.removeObserver :: line 344"  data: no]
TEST-UNEXPECTED-FAIL | addon-sdk/tests/test-page-mod.testDebugMetadata | Test timed out (after: one of the globals is a content script)
Attached file test case
So the problem is in core/observer. It seems that if we add a weak referenced observer to the observer service then a GC happens the observer services loses the reference even though we have a strong reference to it locally.

This only happens when the e10s add-on shims are enabled.

My guess is that somewhere the observer reference we attempt to pass to nsIObserverService is getting wrapped in something when passing through the shim and then that wrapper ends up getting garbage collected even though the thing it wraps is still alive.

This pull request includes a reproducible test case for the bustage.
Attachment #8517702 - Attachment description: pull request → test case
Attached file pull request
In the meantime this should fix the problem for page-mod. We already strongly hold all page-mod references in the pagemods set so there is no point in trying to call them weak references. This makes the observer service strongly reference them.
Attachment #8517706 - Flags: review?(tomica+amo)
Attachment #8517706 - Flags: review?(tomica+amo) → review+
Commits pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/cc9ab06ac9dd0242cb685a95b00dab46d37cd991
Bug 1094392: Don't claim page-mods are weak referential when we already hold a strong reference to them.

https://github.com/mozilla/addon-sdk/commit/a8497a4e85c97f7bfdff72d1db80153b07cdef50
Merge pull request #1701 from Mossop/bug1094392_2

Bug 1094392: Don't claim page-mods are weak referential when we already hold a strong reference to them. r=zombie
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
I filed bug 1131317 for the platform bug that was causing this.
Depends on: 1131317
Commit pushed to master at https://github.com/mozilla/addon-sdk

https://github.com/mozilla/addon-sdk/commit/0aa270ada80c70c1690c9befedf917eca7555d7b
Bug 1094392: Make ObserverDelegee implement nsISupports to keep it from being garbage collected.
(In reply to [github robot] from comment #5)
> Commit pushed to master at https://github.com/mozilla/addon-sdk
> 
> https://github.com/mozilla/addon-sdk/commit/
> 0aa270ada80c70c1690c9befedf917eca7555d7b
> Bug 1094392: Make ObserverDelegee implement nsISupports to keep it from
> being garbage collected.

This should have been for bug 1131741
You need to log in before you can comment on or make changes to this bug.