jakearchibald / idb

IndexedDB, but with promises
https://www.npmjs.com/package/idb
ISC License
6.29k stars 353 forks source link

Error: DataError: Failed to write blobs. #215

Closed zedL closed 3 years ago

zedL commented 3 years ago

Chrome version: Chrome Mobile 88.0.4324 Channel: stable OS Version: Android 8.0.0

Steps to reproduce the problem uploads-db.service.ts.txt :

  1. Go to https://traact.app/
  2. Follow the steps to create a portal and connect a camera.
  3. Configure traact with motion sensor and for video recording in HD & 30 seconds long. That give us about 20 MB files.
  4. Let the application run for some hours.
  5. Monitor console logs.

What is the expected behavior? The mobile browser should not give up writing blobs. Should work like on desktop.

What went wrong? My app records video clips. Since they can get quite large, I implemented caching logic to save the recordings to disc before an upload service takes care of uploading them to a backend.

After some hours off usage I get the Error: "DataError: Failed to write blobs." (only some video clips recorded. not mutch and all uploaded, so indexdb is empty again)

Also an reload of the application dont has any effect. The error will throw again and again. I have to restart my PWA to get it to work again.

I added the complete code for writing to indexed-db as an attachment. Here is the interface for the RecordedContentUpload;

export interface RecordedContentUpload { id: string; data: ArrayBuffer; dataContentType: string; dataThumb: ArrayBuffer; dataThumbContentType: string; faceFound: boolean; recordedAt: string; lastUploadedChunk: number; contentUploadFinished: boolean; duration: number; }

Does this work in other browsers? Yes / Chrome Desctop

With Chrome Desktop it works perfectly. I can cache hundred of files without any problem, and it runs for days.

jakearchibald commented 3 years ago

Is it simply running out of storage space? Is the issue caused by this library or is it a Chrome bug?

zedL commented 3 years ago

No, it is a cache before the data gets uploaded to a backend. The DB is almost always empty. I also made a bug in the Chromium project. => https://bugs.chromium.org/p/chromium/issues/detail?id=1178126 It is a good question where this comes from.

Dexie.js has this issue too => https://github.com/dfahlander/Dexie.js/issues/970 with a workaround.

zedL commented 3 years ago

Ok, it is simply running out of storage space. You can close this issue. I record video clips and want to save them in a cache (indexeddb). In my case the MediaRecorder creates blobs but never get rid of them. My blob list in chrome://blob-internals grows and grows. After some hours I run into the reported error.