Skip to content

Syncing from upstream OCA/storage (16.0)#374

Merged
bt-admin merged 12 commits into
brain-tec:16.0from
OCA:16.0
Jun 24, 2026
Merged

Syncing from upstream OCA/storage (16.0)#374
bt-admin merged 12 commits into
brain-tec:16.0from
OCA:16.0

Conversation

@bt-admin

Copy link
Copy Markdown

bt_gitbot

TecnologiaIG and others added 12 commits May 26, 2026 23:48
``FsFileGC._gc_files_unsafe`` loaded the entire backlog of orphan files
into a single Python list (via ``array_agg(store_fname)`` grouped by
storage) and iterated ``fs.rm`` over all of them in one shot. With the
Azure Blob backend (``adlfs``, same class of issue on ``s3fs`` and other
fsspec-based clients) and tens of thousands of queued orphans, each
HEAD+DELETE pair held onto response buffers and connection-pool state
inside the SDK that was only released when the worker exited.

In production (Odoo.sh, 30k+ orphans, Azure Blob backend) every
autovacuum run hit Odoo's ``limit_memory_hard`` and received
``SIGKILL`` at around minute 17 — 60k+ blob requests per run, zero
``DELETE`` committed, queue never drained, next worker re-ran the same
failing loop. 14 kills observed in a single 24 h window.

Fix: paginate both the ``SELECT`` and the ``fs.rm`` loop per storage,
in batches of ``_GC_BATCH_SIZE = 500``, with an explicit
``gc.collect()`` between batches to reclaim the SDK's buffered state.
The caller ``_gc_files`` still holds the ``SHARE`` lock on
``fs_file_gc`` / ``ir_attachment`` and performs the final commit, so
consistency guarantees and transactional semantics are unchanged.

Signed-off-by: TecnologiaIG <tecnologia@intensegroupgt.com>
…lected

This method can then be used by other extensions to customize how files are deleted based on the specific backend
Signed-off-by lmignon
More code shared with base implementation to list files
s3fs uses aiobotocore as s3 client, which is asynchronous, but Odoo does
not support async calls, therefore the call to delete objects from S3 was
not working. The fsspec library provides a way to run async calls in a
synchronous way. The fsspec.asyn.sync function is now used to run the async
call to delete objects from S3, in a synchronous way, in order to make it
work in Odoo.
Signed-off-by lmignon
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: storage-16.0/storage-16.0-fs_attachment_s3
Translate-URL: https://translation.odoo-community.org/projects/storage-16-0/storage-16-0-fs_attachment_s3/
@bt-admin bt-admin added the 16.0 label Jun 24, 2026
@bt-admin bt-admin merged commit 63df909 into brain-tec:16.0 Jun 24, 2026
4 checks passed
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.81481% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 90.21%. Comparing base (232c1b7) to head (a990967).
⚠️ Report is 119 commits behind head on 16.0.

Files with missing lines Patch % Lines
fs_attachment_s3/models/fs_file_gc.py 78.94% 7 Missing and 1 partial ⚠️
fs_attachment_s3/models/fs_storage.py 75.00% 1 Missing and 1 partial ⚠️
fs_attachment/models/fs_file_gc.py 95.23% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             16.0     #374      +/-   ##
==========================================
- Coverage   90.24%   90.21%   -0.03%     
==========================================
  Files         144      146       +2     
  Lines        4560     4659      +99     
  Branches      406      413       +7     
==========================================
+ Hits         4115     4203      +88     
- Misses        314      322       +8     
- Partials      131      134       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants