Open Bug 1767344 Opened 2 years ago Updated 7 days ago

Intermittent Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

REOPENED
Tracking Status
firefox-esr115 --- affected
firefox121 --- wontfix
firefox122 --- affected
firefox123 --- affected

People

(Reporter: intermittent-bug-filer, Unassigned)

References

(Depends on 1 open bug, Regression)

Details

(Keywords: assertion, intermittent-failure, regression, Whiteboard: [retriggered])

Attachments

(1 obsolete file)

Filed by: abutkovits [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=376541187&repo=autoland
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/DMXZ4CbPT8mnvujoVv154A/runs/0/artifacts/public/logs/live_backing.log
Reftest URL: https://hg.mozilla.org/mozilla-central/raw-file/tip/layout/tools/reftest/reftest-analyzer.xhtml#logurl=https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/DMXZ4CbPT8mnvujoVv154A/runs/0/artifacts/public/logs/live_backing.log&only_show_unexpected=1


[task 2022-05-02T21:07:49.930Z] 21:07:49     INFO - REFTEST TEST-START | intl/lwbrk/crashtests/416721.html
[task 2022-05-02T21:07:49.930Z] 21:07:49     INFO - REFTEST INFO | RESTORE PREFERENCE pref(browser.soft_reload.only_force_validate_top_level_document,true)
[task 2022-05-02T21:07:49.931Z] 21:07:49     INFO - REFTEST TEST-LOAD | file:///opt/worker/tasks/task_165152516798165/build/tests/reftest/tests/intl/lwbrk/crashtests/416721.html | 1412 / 3947 (35%)
[task 2022-05-02T21:07:49.934Z] 21:07:49     INFO - [Parent 1299, Main Thread] WARNING: WebProgress Ignored: no longer current window global: file /builds/worker/checkouts/gecko/dom/ipc/BrowserParent.cpp:3010
[task 2022-05-02T21:07:49.937Z] 21:07:49     INFO - [Child 1550, Main Thread] WARNING: nsAppShell::Exit() called redundantly: file /builds/worker/checkouts/gecko/widget/cocoa/nsAppShell.mm:823
[task 2022-05-02T21:07:49.939Z] 21:07:49     INFO - ###!!! [Parent][PImageBridgeParent] Error: RunMessage(msgname=PImageBridge::Msg_WillClose) Channel closing: too late to send/recv, messages will be lost
[task 2022-05-02T21:07:49.941Z] 21:07:49     INFO - Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133
[task 2022-05-02T21:07:49.941Z] 21:07:49     INFO - [Child 1550, Main Thread] WARNING: IPC message 'PIdleScheduler::Msg_StartedGC' discarded: actor cannot send: file /builds/worker/checkouts/gecko/ipc/glue/ProtocolUtils.cpp:506
[task 2022-05-02T21:07:49.944Z] 21:07:49     INFO - #01: mozilla::image::AnimationSurfaceProvider::~AnimationSurfaceProvider() [image/AnimationSurfaceProvider.cpp:53]
[task 2022-05-02T21:07:49.945Z] 21:07:49     INFO - #02: mozilla::image::AnimationSurfaceProvider::Release() [image/AnimationSurfaceProvider.h:37]
[task 2022-05-02T21:07:49.945Z] 21:07:49     INFO - #03: mozilla::image::DecodingTask::~DecodingTask() [image/DecodePool.cpp:137]
[task 2022-05-02T21:07:49.946Z] 21:07:49     INFO - #04: mozilla::TaskController::RunPoolThread() [xpcom/threads/TaskController.cpp:301]
[task 2022-05-02T21:07:50.169Z] 21:07:50     INFO - #05: _pt_root [nsprpub/pr/src/pthreads/ptthread.c:204]
[task 2022-05-02T21:07:50.170Z] 21:07:50     INFO - #06: _pthread_start [/usr/lib/system/libsystem_pthread.dylib + 0x6109]
[task 2022-05-02T21:07:50.176Z] 21:07:50     INFO - REFTEST TEST-PASS | intl/lwbrk/crashtests/416721.html | (LOAD ONLY)
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → INCOMPLETE
Status: RESOLVED → REOPENED
Resolution: INCOMPLETE → ---

This fails frequently on some windows 11 gpu jobs.
Seeing that the assertion is followed by a crash at dom/canvas/test/mochitest.toml and since you worked with canvas lately, I was wondering if you could please take a look at this Lee? Maybe you can spot something that is causing this.
Thank you!

Flags: needinfo?(lsalzman)
Summary: Intermittent Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133 → Frequent Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133
Whiteboard: [retriggered]

It looks like this was an oversight in bug 1276549, that in one place an
already_AddRefed does not get converted to a RefPtr.

Assignee: nobody → lsalzman
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a4148511920c Don't leak runnables on shutdown. r=aosmond

Backed out for causing gpu related leak failures

Backout link

Push with failures

Failure log

Flags: needinfo?(lsalzman)
Depends on: 1872327

Comment on attachment 9370406 [details]
Bug 1767344 - Don't leak runnables on shutdown. r?aosmond

Revision D197374 was moved to bug 1872327. Setting attachment 9370406 [details] to obsolete.

Attachment #9370406 - Attachment is obsolete: true

It looks like this was ultimately caused by bug 1155059 when it converted Dispatch calls to take already_AddRef<nsIRunnable> instead of nsIRunnable*. In shutdown cases where it returns an error, these functions then leak the nsIRunnable, which is what triggers this assert.

The problem with just straight-up fixing these is that this can hide other shutdown bugs. So while superficially this manifests as one single intermittent, trying to just fix most of the instances in xpcom/threads will probably cause other downwind intermittents to be exposed because of why the runnables were being supplied during shutdown in the first place.

A large portion of them seem to be coming from inside xpcom/threads/nsThread.cpp and nsThreadPool.cpp. I happened to step on one of them in nsThreadPool.cpp and attempting to at least fix that one in dependent bug 1872327, which I have split off so that further instances of this can be addressed by somebody at some point, rather than ignored.

It is feasible that some of these might even stem from other places in the code outside of xpcom/threads and just masquerading under this signature, so it might also make sense to categorize the known intermittents there with explicit asserts (rather than an NS_WARNING and an unintentional already_AddRef assert) if an immediate fix is not desired, so as to separate the causes inside xpcom/threads from potential future cases outside of it.

Assignee: lsalzman → nobody
Severity: S4 → --
Component: Internationalization → XPCOM
Keywords: regression
Priority: P5 → --
Regressed by: 1155059

Set release status flags based on info from the regressing bug 1155059

:jesup, since you are the author of the regressor, bug 1155059, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(rjesup)

The failure in https://searchfox.org/mozilla-central/rev/28cc363411d2029aed04c969c8f98785cae110db/dom/file/ipc/RemoteLazyInputStreamThread.cpp#154 is a minor bug, because the already_AddRefed is leaked by casting to (void). This does leak the reference in release builds, but will hit this assertion in debug builds.

In order to avoid the assertion you need to use the Unused << overloaded operator (https://searchfox.org/mozilla-central/rev/28cc363411d2029aed04c969c8f98785cae110db/mfbt/AlreadyAddRefed.h#142-150).

Flags: needinfo?(jstutte)

There also appears to be one around here: https://searchfox.org/mozilla-central/rev/28cc363411d2029aed04c969c8f98785cae110db/image/SurfaceCache.cpp#1948, where it appears that if we hit this case, we will leak the reference as expected, but also hit an assertion failure.

Depends on: 1889080
Depends on: 1889083

Filed two new bugs, patches are there.

Flags: needinfo?(jstutte)

There's one new case from the most recent intermittent failures report: https://searchfox.org/mozilla-central/rev/7ddf1affe2c1fe192fdf88b70a21872af543666f/xpcom/threads/WinHandleWatcher.cpp#128,137,146,162 the aRunnable argument is dropped without being explicitly leaked or released in the first two error cases. The other case is from the day before :jstutte's patch fixing the issue landed.

I think we can file that last report and then close this bug for now. We can open a new one if the issue comes up again.

Severity: -- → S3
Summary: Frequent Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133 → Intermittent Assertion failure: !mRawPtr, at /builds/worker/workspace/obj-build/dist/include/mozilla/AlreadyAddRefed.h:133
Depends on: 1905656
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: