Skip to content

Classify WebKit 'without an in-progress transaction' IndexedDB errors as transient - #832

Open
sosek108 wants to merge 1 commit into
Expensify:mainfrom
callstack-internal:fix/idb-no-in-progress-transaction-transient
Open

Classify WebKit 'without an in-progress transaction' IndexedDB errors as transient#832
sosek108 wants to merge 1 commit into
Expensify:mainfrom
callstack-internal:fix/idb-no-in-progress-transaction-transient

Conversation

@sosek108

@sosek108 sosek108 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Details

WebKit's IndexedDB server can tear down transactions under a live connection (page reload, or foregrounding a tab after process suspension). When that happens, every in-flight operation fails with an UnknownError DOMException from the same family:

  • Attempt to get a record from database without an in-progress transaction
  • Attempt to get records from database without an in-progress transaction
  • Attempt to generate key in database without an in-progress transaction

These are emitted by WebKit's SQLiteIDBBackingStore and only ever occur on WebKit browsers (iOS Safari, Chrome/Edge/Google iOS shells, macOS Safari) — Sentry tag distribution on the linked issue is 100% WebKit.

classifyIDBError currently classifies them as UNKNOWN, so the connection layer propagates them without retrying. The visible damage is at app boot: the initial getAll fails and Onyx boots with default key states only ("Failed to load data from storage during init"), dropping the whole local cache for that session even though the data is intact on disk.

Production logs show that sibling errors from the very same failure episodes (AbortError-flavored aborts) are already classified TRANSIENT and recover on the same-instant reopen-and-retry. This PR extends the TRANSIENT bucket to the without an in-progress transaction family (matched on the shared message suffix), so the connection layer drops the stale cached connection and retries once with a fresh one instead of giving up.

Related Issues

Expensify/App#100046

Linked E/App PR

Expensify/App#99900

Automated Tests

Added two tests to createStoreTest.ts mirroring the existing transient-retry coverage:

  • should retry once and succeed on a WebKit "without an in-progress transaction" UnknownError — read path: first transaction fails with the WebKit UnknownError, the connection layer logs IDB transient error, reopens, and the read succeeds.
  • should retry once and succeed on a WebKit "generate key" UnknownError during a write — write path: same recovery for a readwrite transaction, and the written value is readable afterwards.

Manual Tests

  1. Run the App web build with this Onyx version and sign in.
  2. In the browser console, force the next IDB transaction to fail with the WebKit error:
    const original = IDBDatabase.prototype.transaction;
    let thrown = false;
    IDBDatabase.prototype.transaction = function (...args) {
        if (!thrown) {
            thrown = true;
            throw new DOMException('Attempt to get a record from database without an in-progress transaction', 'UnknownError');
        }
        return original.apply(this, args);
    };
  3. Trigger Onyx activity (open a report, send a message).
  4. Verify the console shows [Onyx] IDB transient error — dropping cached connection and retrying once (instead of IDB error not recoverable at the connection layer, propagating), the action completes, and the data survives a page reload.

Author Checklist

  • I linked the correct issue in the ### Related Issues section above
  • I linked the corresponding Expensify/App PR in the ### Linked E/App PR section above, and verified this change against it (E/App CI passed and manual testing completed)
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android / native
    • Android / Chrome
    • iOS / native
    • iOS / Safari
    • MacOS / Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that the left part of a conditional rendering a React component is a boolean and NOT a string, e.g. myBool && <MyComponent />.
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.js or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If a new component is created I verified that:
    • A similar component doesn't exist in the codebase
    • All props are defined accurately and each prop has a /** comment above it */
    • The file is named correctly
    • The component has a clear name that is non-ambiguous and the purpose of the component can be inferred from the name alone
    • The only data being stored in the state is data necessary for rendering and nothing else
    • If we are not using the full Onyx data that we loaded, I've added the proper selector in order to ensure the component only re-renders when the data it is using changes
    • For Class Components, any internal methods passed to components event handlers are bound to this properly so there are no scoping issues (i.e. for onClick={this.submit} the method this.submit should be bound to this in the constructor)
    • Any internal methods bound to this are necessary to be bound (i.e. avoid this.submit = this.submit.bind(this); if this.submit is never passed to a component event handler like onClick)
    • All JSX used for rendering exists in the render method
    • The component has the minimum amount of code necessary for its purpose, and it is broken down into smaller components in order to separate concerns and functions
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the main branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to the Test steps.
  • I have checked off every checkbox in the PR author checklist, including those that don't apply to this PR.

Screenshots/Videos

Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant