Closed Bug 1696134 Opened 4 years ago Closed 4 years ago

Assertion failure: mValue.second() != kNullValue, at obj-x86_64-pc-solaris2.11/dist/include/mozilla/Result.h:113

Categories

(Core :: Storage: IndexedDB, defect, P3)

defect

Tracking

()

RESOLVED FIXED
88 Branch
Tracking Status
firefox-esr78 --- unaffected
firefox86 --- wontfix
firefox87 --- wontfix
firefox88 --- fixed

People

(Reporter: petr.sumbera, Assigned: sg)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:86.0) Gecko/20100101 Firefox/86.0

Steps to reproduce:

I see following assertion when I'm running out of space (via quota) at my home directory. This was already spotted via Bug 1684997.

Assertion failure: mValue.second() != kNullValue, at /builds/psumbera/FIREFOX/obj-x86_64-pc-solaris2.11/dist/include/mozilla/Result.h:113
#01: mozilla::detail::ResultImplementationNullIsOkBase<mozilla::Ok, nsresult>::ResultImplementationNullIsOkBase(nsresult)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x149fd606]
#02: mozilla::detail::ResultImplementationNullIsOk<mozilla::Ok, nsresult, true>::ResultImplementationNullIsOkBase(nsresult)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x149f2a78]
#03: mozilla::detail::ResultImplementation<mozilla::Ok, nsresult, (mozilla::detail::PackingStrategy)1>::ResultImplementationNullIsOkBase(nsresult)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x149f2a9c]
#04: mozilla::Result<mozilla::Ok, nsresult>::Result(nsresult)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18b8942a]
#05: mozilla::Result<mozilla::Ok, std::result_of<mozilla::dom::indexedDB::(anonymous namespace)::SetDefaultPragmas(mozIStorageConnection&)::{lambda(nsresult)#1} (nsresult)>::type> mozilla::Result<mozilla::Ok, nsresult>::mapErr<mozilla::dom::indexedDB::(anonymo[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18e2140e]
#06: mozilla::dom::indexedDB::(anonymous namespace)::SetDefaultPragmas(mozIStorageConnection&)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18db0576]
#07: mozilla::dom::indexedDB::(anonymous namespace)::CreateStorageConnection(nsIFile&, nsIFile&, nsTSubstring<char16_t> const&, nsTSubstring<char> const&, long, unsigned int, mozilla::Maybe<mozilla::dom::quota::DummyCipherStrategy::KeyType> const&)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18db247b]
#08: mozilla::dom::indexedDB::(anonymous namespace)::OpenDatabaseOp::DoDatabaseWork()[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18dfce8c]
#09: mozilla::dom::indexedDB::(anonymous namespace)::FactoryOp::Run()[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x18dfae2f]
#10: nsThread::ProcessNextEvent(bool, bool*)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x14b95e51]
#11: NS_ProcessNextEvent(nsIThread*, bool)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x14ba04fd]
#12: mozilla::ipc::MessagePumpForNonMainThreads::Run(base::MessagePump::Delegate*)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x15419966]
#13: MessageLoop::RunInternal()[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x1537c391]
#14: MessageLoop::RunHandler()[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x1537c314]
#15: MessageLoop::Run()[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x1537c2d7]
#16: nsThread::ThreadFunc(void*)[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libxul.so +0x14b92f21]
#17: _pt_root[/builds/psumbera/FIREFOX-INSTALL/lib/firefox/libnspr4.so +0x4a0f8]
#18: _thrp_setup[/lib/amd64/libc.so.1 +0x271863]
#19: _lwp_start[/lib/amd64/libc.so.1 +0x271b60]
[Socket 3810, Main Thread] WARNING: Shutting down Socket process early due to a crash!: file /builds/psumbera/FIREFOX/netwerk/ipc/SocketProcessChild.cpp:160

The Bugbug bot thinks this bug should belong to the 'Core::Storage: IndexedDB' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → Storage: IndexedDB
Product: Firefox → Core

Thanks for reporting this. Unfortunately, the report on Bug 1684997 didn't have a symbolized stack trace, so probably it wasn't deemed actionable by whoever looked at it. It's not completely clear, but indeed very likely it's the same issue.

I think I found the cause of this, the lines at https://searchfox.org/mozilla-central/rev/63fcc3f1a2cc73488d8986f4cf91fce2cd4b7564/dom/indexedDB/ActorsParent.cpp#671-673 must be changed to:

    IDB_TRY(
        ToResult(aConnection.SetGrowthIncrement(kSQLiteGrowthIncrement, ""_ns))
            .orElse(ErrToDefaultOkOrErr<NS_ERROR_FILE_TOO_BIG, Ok>));
Regressed by: 1663924
Has Regression Range: --- → yes
Assignee: nobody → sgiesecke
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Thanks for looking at it!

With the patch it no longer hits the assertion and in the console I can see:

[Parent 29902, QuotaManager IO] WARNING: QuotaManager failure: 'aConnection.ExecuteSimpleSQL(kDeleteCacheQuery) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED), context=Initialization::Storage', file /builds/psumbera/FIREFOX/dom/quota/ActorsParent.cpp:544
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: '(::mozilla::ToResultInvoke( (connection), &::mozilla::detail::DerefedType<decltype(connection)>::ExecuteSimpleSQL, "PRAGMA auto_vacuum = INCREMENTAL;"_ns) .mapErr(mapNoDeviceSpaceError)) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:901
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: 'CreateStorageConnection(*dbFile, *fmDirectory, databaseName, mOriginMetadata.mOrigin, mDirectoryLockId, mTelemetryId, maybeKey) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:16052
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: 'DoDatabaseWork() failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:15811
[Parent 29902, IPDL Background] WARNING: Converting non-IndexedDB error code (0x80520015) to NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR: file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:537
[Parent 29902, QuotaManager IO] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED): file /builds/psumbera/FIREFOX/storage/mozStorageService.cpp:627
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: '::mozilla::ToResultInvoke<nsCOMPtr<mozIStorageConnection>>( ::std::mem_fn( &::mozilla::detail::DerefedType<decltype(aStorageService)>::OpenDatabaseWithFileURL), (aStorageService), &aFileURL, telemetryFilename) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:719
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: 'OpenDatabase(aStorageService, aFileURL, aTelemetryId) .map([](auto connection) -> ConnectionType { return Some(std::move(connection)); }) .orElse(ErrToDefaultOkOrErr<NS_ERROR_STORAGE_BUSY, ConnectionType>) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:736
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: 'OpenDatabaseAndHandleBusy(*storageService, *dbFileUrl, aTelemetryId) .map([](auto connection) -> nsCOMPtr<mozIStorageConnection> { return std::move(connection).unwrapBasePtr(); }) .orElse([&aName](nsresult aValue) -> Result<nsCOMPtr<mozIStorageConnection>, nsresult> { if (!IsDatabaseCorruptionError(aValue) || aName.IsVoid()) { return Err(aValue); } return nsCOMPtr<mozIStorageConnection>(); }) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:832
[Parent 29902, QuotaManager IO] WARNING: IndexedDB failure: 'CreateStorageConnection(*dbFile, *fmDirectory, databaseName, mOriginMetadata.mOrigin, mDirectoryLockId, mTelemetryId, maybeKey) failed with result 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)', file /builds/psumbera/FIREFOX/dom/indexedDB/ActorsParent.cpp:16052

Good that the assertion failure is gone, and it no longer crashes. Obviously, it can't work without errors when there's no space left, but these particular errors (NS_ERROR_FILE_ACCESS_DENIED) don't seem completely right.

Jan, WDYT? It seems that the database wasn't correctly closed because of the space limitation situation?

Petr, not sure what you're saying, is the user experience the expected one for you, or are you seeing errors that shouldn't be there despite the space limit being hit?

Flags: needinfo?(jvarga)

(In reply to Simon Giesecke [:sg] [he/him] from comment #5)

Petr, not sure what you're saying, is the user experience the expected one for you, or are you seeing errors that shouldn't be there despite the space limit being hit?

I think I'm ok now. There is no assertion where I originally have no clue it's about disk space. Now I see warnings which could suggest there is disk space problem...

Pushed by sgiesecke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c64a67586a65 Fix suppression of error in SetDefaultPragmas. r=dom-storage-reviewers,janv

(In reply to Simon Giesecke [:sg] [he/him] from comment #5)

Good that the assertion failure is gone, and it no longer crashes. Obviously, it can't work without errors when there's no space left, but these particular errors (NS_ERROR_FILE_ACCESS_DENIED) don't seem completely right.

Jan, WDYT? It seems that the database wasn't correctly closed because of the space limitation situation?

Hm, I'm not sure, it's interesting that we get the error for storage.sqlite and also for the IDB database.
I can imagine a variety of problems when there's no free disk space, but we shouldn't crash at least and it seems that was fixed.

Flags: needinfo?(jvarga)
Severity: -- → S3
Priority: -- → P3
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: