Skip to content

[18.0][IMP] MemoryError failures with high volume exports - #3

Closed
StephaneMangin wants to merge 60 commits into
19.0from
18.0-mig-base_export_async
Closed

StephaneMangin wants to merge 60 commits into
19.0from
18.0-mig-base_export_async

Conversation

@StephaneMangin

@StephaneMangin StephaneMangin commented Oct 14, 2026 •

Copy link
Copy Markdown

Based on OCA#849, the last commit to review for this PR.

Large asynchronous export fails with a MemoryError, what's implemented:

Benchmarks

Fake partners (8 fields including a many2many):

# Records Format RAM before RAM after Time before Time after
30,000 csv 152 MiB 61 MiB 9.4 s 9.3 s
30,000 xlsx 281 MiB 37 MiB 20.7 s 22.2 s
200,000 csv 1,073 MiB 390 MiB 61.5 s 57.3 s
200,000 xlsx 1,953 MiB 229 MiB 141.8 s 158.5 s

Real case

33,557 invoices exported in xlsx, peak memory of the process (Odoo default limits: 2,048 MiB soft, 2,560 MiB hard):

Models RAM before RAM after Time before Time after
Invoices and lines with 17 fields 732 MiB 353 MiB 47.0 s 48.7 s
Invoices, lines and reconciliations with 30 fields 2,190 MiB 429 MiB 125.5 s 103.0 s

The xlsx export now uses temporary files (about twice the uncompressed sheet, removed once exported).

apineux and others added 30 commits November 3, 2025 09:45
Currently translated at 100.0% (19 of 19 strings)

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/de/
Currently translated at 100.0% (19 of 19 strings)

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/zh_Hans/
The UI still send it to the current user, but it will allow
reusing the module for other purposes: plan a regular export
to users.

Setting the recipient_ids instead of the email_to in mail.mail means
that we can still send the email, it will stay in the failed emails,
allowing to correct the user.
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/
oca-transbot and others added 29 commits November 3, 2025 09:45
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/
Currently translated at 100.0% (18 of 18 strings)

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/da/
Currently translated at 94.4% (17 of 18 strings)

Translation: queue-12.0/queue-12.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-12-0/queue-12-0-base_export_async/pt/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-15.0/queue-15.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-15-0/queue-15-0-base_export_async/
Currently translated at 100.0% (22 of 22 strings)

Translation: queue-16.0/queue-16.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/es/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: queue-16.0/queue-16.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/
Currently translated at 100.0% (22 of 22 strings)

Translation: queue-16.0/queue-16.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/it/
Currently translated at 100.0% (22 of 22 strings)

Translation: queue-16.0/queue-16.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/it/
Currently translated at 100.0% (22 of 22 strings)

Translation: queue-16.0/queue-16.0-base_export_async
Translate-URL: https://translation.odoo-community.org/projects/queue-16-0/queue-16-0-base_export_async/fr/
As normal user only have read access to delay.export, we need sudo to chreate an attachment on this record

Use user 6 (Marc Demo) in the tests, not admin (2)
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.