Out of memory error while opening IndexedDB causing Edge/Chrome browsers to crash frequently

1,243 views
Skip to first unread message

Vibhash Chandra

unread,
Mar 27, 2024, 4:03:15 AM3/27/24
to Chromium Extensions
Hi,

I am working on manifest v3 migration of an extension which was using file system API to store generated data like images, videos and files (1 MB - 50 MB max). Since file system API can no longer be used from service worker to store generated data, we switched to Indexed DB.

Recently we observed that it started causing browser crashes with very high memory usage (upto 15 GB). The issue is almost similar to what has been mentioned below:


Any suggestions about how to handle such cases?

Regards,
Vibhash.

wOxxOm

unread,
Mar 27, 2024, 9:40:13 AM3/27/24
to Chromium Extensions, Vibhash Chandra
Sounds like a bug in Chrome. Maybe go back to file system API in the offscreen document?

Juraj M.

unread,
Mar 27, 2024, 10:03:30 AM3/27/24
to Chromium Extensions, wOxxOm, Vibhash Chandra
I was greatly affected by this issue in the past, Chromium browsers would allocate gigabytes of RAM (!!!) on start, and my IndexedDB had less than 100MB data inside.
The cause was long strings - I was storing images as Base64 strings, and once I migrated them all to Blobs, the problem got completely fixed. That was 2 years ago and since then, nobody reported it anymore.

Vibhash Chandra

unread,
Mar 27, 2024, 11:20:39 PM3/27/24
to Juraj M., Chromium Extensions, wOxxOm
Is there a way to reproduce this issue in browsers other than impacted ones to test any fixes. I am also storing images and videos as Base64 strings. I can try using blobs.

Regards,
Vibhash.

Juraj M.

unread,
Mar 28, 2024, 4:02:06 AM3/28/24
to Chromium Extensions, Vibhash Chandra, Chromium Extensions, wOxxOm, Juraj M.
Reproducing is tricky.
I was lucky because my friend at the office could reproduce it (he was complaining that his Chrome freezes for a few seconds on start) so I've borrowed his PC and run some tests.
From what I remember, the easiest way to reproduce it was rebooting PC and then starting Chrome.
Because if you only close Chrome and reopen it right away, it won't break. It happened also if the Chrome was closed for some time.
During the "freeze", the RAM was filling up. So if the freeze was long, it would consume more than half of his 16GB RAM.
I did tried to reproduce it on my PC, but I never could, although I gave up pretty fast after I've copied his IndexedDB to my PC and it still worked fine.

It was obviously some kind of race condition, so maybe combination of slower CPU and most likely slower SSD is the best candidate for reproducing it.
Some users wrote me that reinstalling extension helps for some time, but after some days/weeks, the problem will slowly return. So again, clean profile may be harder to reproduce.

Vibhash Chandra

unread,
Apr 1, 2024, 11:03:59 PM4/1/24
to Chromium Extensions, Juraj M., Vibhash Chandra, Chromium Extensions, wOxxOm
I encountered this issue again. IndexedDB grew to 5 GB. What looks odd is that I believe most of the operations would have resulted in hardly 100 MB data.

Regards,
Vibhash.

Juraj M.

unread,
Apr 2, 2024, 3:10:22 AM4/2/24
to Chromium Extensions, Vibhash Chandra, Juraj M., Chromium Extensions, wOxxOm
Even after migrating to blobs?
Note that you have to delete the long strings afterwards, even if they are not accessed, they will still cause the issue.

Vibhash Chandra

unread,
Apr 2, 2024, 3:29:12 AM4/2/24
to Juraj M., Chromium Extensions, wOxxOm
I am yet to migrate to blobs.

Any idea why long strings cause issues even when they are not being accessed?

I am also perplexed why IndexedDB goes in GB (manifest-000001 file), when data that checks from extension remains in MB.

Out of multiple use cases of extension, it seems that this issue happens during screen recording and even for few seconds of recording producing a file of a few MBs is causing indexedDB to grow much faster.

Regards,
Vibhash.
Reply all
Reply to author
Forward
0 new messages