Closed Bug 1874334 Opened 10 months ago Closed 4 months ago

DecreaseCachedQuotaUsage /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp

Categories

(Core :: DOM: File, defect, P2)

defect

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- wontfix
firefox125 --- wontfix
firefox126 --- fixed

People

(Reporter: tsmith, Assigned: jjalkanen)

References

(Blocks 1 open bug, Regression)

Details

(4 keywords, Whiteboard: [bugmon:bisected,confirmed])

Attachments

(7 files, 1 obsolete file)

Attached file testcase.zip —

Found while fuzzing m-c 20231121-7bc9f9c659dd (--enable-debug --enable-fuzzing)

To reproduce via Grizzly Replay:

$ pip install fuzzfetch grizzly-framework
$ python -m fuzzfetch -d --fuzzing -n firefox
$ python -m grizzly.replay.bugzilla ./firefox/firefox <bugid>

Assertion failure: uint64_t(aDest) >= uint64_t(aArg), at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/quota/AssertionsImpl.h:47

#0 0x7feb7ae32138 in AssertNoUnderflow<unsigned long, long> /builds/worker/workspace/obj-build/dist/include/mozilla/dom/quota/AssertionsImpl.h:47:3
#1 0x7feb7ae32138 in mozilla::dom::quota::OriginInfo::LockedDecreaseUsage(mozilla::dom::quota::Client::Type, long) /builds/worker/checkouts/gecko/dom/quota/OriginInfo.cpp:112:3
#2 0x7feb7addbf47 in mozilla::dom::quota::QuotaManager::DecreaseUsageForClient(mozilla::dom::quota::ClientMetadata const&, long) /builds/worker/checkouts/gecko/dom/quota/ActorsParent.cpp:2520:17
#3 0x7feb7a038f56 in DecreaseCachedQuotaUsage /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp:1232:17
#4 0x7feb7a038f56 in mozilla::dom::fs::data::FileSystemDatabaseManagerVersion002::MergeFileId(nsTString<char> const&, mozilla::dom::fs::FileId const&, bool)::$_1::operator()(mozilla::dom::fs::FileId const&) const /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion002.cpp:667:9
#5 0x7feb7a03819f in mozilla::dom::fs::data::FileSystemDatabaseManagerVersion002::MergeFileId(nsTString<char> const&, mozilla::dom::fs::FileId const&, bool) /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion002.cpp:694:5
#6 0x7feb7a01e6b1 in mozilla::dom::fs::data::FileSystemDataManager::UnlockShared(nsTString<char> const&, mozilla::dom::fs::FileId const&, bool) /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDataManager.cpp:498:3
#7 0x7feb7a005dad in mozilla::dom::FileSystemWritableFileStreamParent::RecvClose(bool, std::function<void (mozilla::void_t const&)>&&) /builds/worker/checkouts/gecko/dom/fs/parent/FileSystemWritableFileStreamParent.cpp:41:3
#8 0x7feb7a06936f in mozilla::dom::PFileSystemWritableFileStreamParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PFileSystemWritableFileStreamParent.cpp:157:102
#9 0x7feb7a0645f7 in mozilla::dom::PFileSystemManagerParent::OnMessageReceived(IPC::Message const&) /builds/worker/workspace/obj-build/ipc/ipdl/PFileSystemManagerParent.cpp:304:32
#10 0x7feb772d85cf in mozilla::ipc::MessageChannel::DispatchAsyncMessage(mozilla::ipc::ActorLifecycleProxy*, IPC::Message const&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1813:25
#11 0x7feb772d5322 in mozilla::ipc::MessageChannel::DispatchMessage(mozilla::ipc::ActorLifecycleProxy*, mozilla::UniquePtr<IPC::Message, mozilla::DefaultDelete<IPC::Message>>) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1732:9
#12 0x7feb772d5fa2 in mozilla::ipc::MessageChannel::RunMessage(mozilla::ipc::ActorLifecycleProxy*, mozilla::ipc::MessageChannel::MessageTask&) /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1525:3
#13 0x7feb772d70ef in mozilla::ipc::MessageChannel::MessageTask::Run() /builds/worker/checkouts/gecko/ipc/glue/MessageChannel.cpp:1623:14
#14 0x7feb765fbe5b in mozilla::TaskQueue::Runner::Run() /builds/worker/checkouts/gecko/xpcom/threads/TaskQueue.cpp:257:20
#15 0x7feb766268d5 in nsThreadPool::Run() /builds/worker/checkouts/gecko/xpcom/threads/nsThreadPool.cpp:341:14
#16 0x7feb7661ceed in nsThread::ProcessNextEvent(bool, bool*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:1192:16
#17 0x7feb76623dcd in NS_ProcessNextEvent(nsIThread*, bool) /builds/worker/checkouts/gecko/xpcom/threads/nsThreadUtils.cpp:480:10
#18 0x7feb772df6ce in mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*) /builds/worker/checkouts/gecko/ipc/glue/MessagePump.cpp:300:20
#19 0x7feb771f8461 in RunHandler /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:363:3
#20 0x7feb771f8461 in MessageLoop::Run() /builds/worker/checkouts/gecko/ipc/chromium/src/base/message_loop.cc:345:3
#21 0x7feb766181d3 in nsThread::ThreadFunc(void*) /builds/worker/checkouts/gecko/xpcom/threads/nsThread.cpp:370:10
#22 0x7feb8abecd0f in _pt_root /builds/worker/checkouts/gecko/nsprpub/pr/src/pthreads/ptthread.c:201:5
#23 0x7feb8b48dac2 in start_thread nptl/pthread_create.c:442:8
#24 0x7feb8b51ebf3 in __clone misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:100

Verified bug as reproducible on mozilla-central 20240112045806-1d2ccbe0bb6d.
The bug appears to have been introduced in the following build range:

Start: be6843e3475a7f536156aba03a849fe701932b0c (20230628154748)
End: 0df511b69760b69959818e34e07aa74a0ad7061a (20230628173448)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=be6843e3475a7f536156aba03a849fe701932b0c&tochange=0df511b69760b69959818e34e07aa74a0ad7061a

Keywords: regression
Whiteboard: [bugmon:bisected,confirmed]
Regressed by: 1824305

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

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

For more information, please visit BugBot documentation.

Flags: needinfo?(jjalkanen)
Assignee: nobody → jjalkanen
Flags: needinfo?(jjalkanen)
Severity: -- → S3
Priority: -- → P2

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

Keywords: pernosco-wanted

Successfully recorded a pernosco session. A link to the pernosco session will be added here shortly.

A pernosco session for this bug can be found here.

:jari do you happen to know if this assertion failure has any user facing impact?

Flags: needinfo?(jjalkanen)
Attachment #9391306 - Attachment description: Bug 1874334 - Release blockers when sync shutdown prevents IPC. r=#dom-storage → Bug 1874334 - Release blockers when WritableFileStream without actor is closing. r=#dom-storage

There is some user facing impact even though nothing will crash or break.

Flags: needinfo?(jjalkanen)
Pushed by jjalkanen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5e1a6b776f69 Add fuzzing finding to OPFS crashtest suite. r=dom-storage-reviewers,janv https://hg.mozilla.org/integration/autoland/rev/ab8f6bc22e59 Add worker related fuzzing finding to OPFS crashtest suite; r=dom-storage-reviewers,jari https://hg.mozilla.org/integration/autoland/rev/7684de0452a5 Update cached quota usage when OPFS temporary file is copied. r=dom-storage-reviewers,janv https://hg.mozilla.org/integration/autoland/rev/a872d74549a4 Abort open writable file streams during xpcom-will-shutdown shutdown phase; r=dom-storage-reviewers,jstutte
Status: RESOLVED → REOPENED
Flags: needinfo?(jjalkanen)
Resolution: FIXED → ---
Target Milestone: 126 Branch → ---

I'm not sure if this patch from autoland was yet based on the supposed fix. Let's keep an eye on the situation.

Flags: needinfo?(jjalkanen)

Testcase crashes using the initial build (mozilla-central 20231121183118-7bc9f9c659dd) but not with tip (mozilla-central 20240412214434-be4463b26a49.)

The bug appears to have been fixed in the following build range:

Start: 9c458764557de25f93134811a808f6c5b68b5683 (20240327123927)
End: bc7ca80e302a788b0c3cc63cb148c628351b4946 (20240327133848)
Pushlog: https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=9c458764557de25f93134811a808f6c5b68b5683&tochange=bc7ca80e302a788b0c3cc63cb148c628351b4946

jjalkanen, can you confirm that the above bisection range is responsible for fixing this issue?
Removing bugmon keyword as no further action possible. Please review the bug and re-add the keyword for further analysis.

Flags: needinfo?(jjalkanen)
Keywords: bugmon

The latest intermittent failure is for cache from test dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py and unrelated to the fuzzing finding. They have the same line in the logs only because they use the same underflow check helper from dom/quota.

Therefore, I would conclude that the above bisection range (and the attached patch) are responsible for fixing the fuzzing finding.

Flags: needinfo?(jjalkanen)
Attachment #9392084 - Attachment is obsolete: true
Summary: Assertion failure: uint64_t(aDest) >= uint64_t(aArg), at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/quota/AssertionsImpl.h:47 → DecreaseCachedQuotaUsage /builds/worker/checkouts/gecko/dom/fs/parent/datamodel/FileSystemDatabaseManagerVersion001.cpp

The line Assertion failure: uint64_t(aDest) >= uint64_t(aArg), at /builds/worker/workspace/obj-build/dist/include/mozilla/dom/quota/AssertionsImpl.h:47 is present in the logs whenever a quota client has an underflow. The crashes from dom/cache/test/marionette/test_caches_delete_cleanup_after_shutdown.py and dom/workers/test/marionette/test_service_workers_disabled.py should not be associated with this bug which has not been reproducible after the patch landed.

Status: REOPENED → RESOLVED
Closed: 7 months ago4 months ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: