When deleting a Strapi folder with a lot of files not all files on Cloud Storage get deleted.
westende opened this issue · 0 comments
Describe the bug
When a Strapi folder containing a large amount (approximately 3400) of files gets removed not all files are removed from Cloud Storage. Approximately 13.000 files remain in object storage including derivative images (small, medium, large, etc). They are however removed from the files table in the database.
To Reproduce
Steps to reproduce the behavior:
- Go to 'Media Library'
- Create a folder
- Upload 3400 files
- Remove folder
- Not all files will be removed from Cloud Storage
Expected behavior
All associated files should be removed from cloud storage.
Desktop (please complete the following information):
- OS: OSx
- Browser Firefox
- Version 115
Additional context
During deletion of the folder in Strapi the Strapi backend returned an HTTP 500.
I traced it back to:
KnexTimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
at Client_PG.acquireConnection (/opt/node_modules/knex/lib/client.js:312:26)
at runNextTicks (node:internal/process/task_queues:60:5)
at listOnTimeout (node:internal/timers:538:9)
at process.processTimers (node:internal/timers:512:7)
at async Runner.ensureConnection (/opt/node_modules/knex/lib/execution/runner.js:287:28)
at async Runner.run (/opt/node_modules/knex/lib/execution/runner.js:30:19)
at async Object.execute (/opt/node_modules/@strapi/database/lib/query/query-builder.js:481:22)
at async Object.findOne (/opt/node_modules/@strapi/database/lib/entity-manager/index.js:178:22)
at async Object.remove (/opt/node_modules/@strapi/plugin-upload/server/services/upload.js:399:19)
at async Promise.all (index 27)
In a second run I also see an OOM error:
Memory limit of 2048 MiB exceeded with 2089 MiB used. Consider increasing the memory limit, see https://cloud.google.com/run/docs/configuring/memory-limits
Perhaps the reason not all associated files were removed is related to the removal process being interrupted.