← Back to Pull requests

[18.0][IMP] MemoryError failures for big exports #1010

Open
unknown opened this pull request with 158 lines diff across 1 files
View on GitHub
unknown unknown commented on Oct 14, 2026 07:45 UTC
Author

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

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

  • export_data by batches of PREFETCH_MAX and cache invalidation between batches (as odoo/odoo#257333 does for the web export);

  • writes xlsx files in the constant memory mode and not just in_memory (deactivated).
  • 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).

    Diff: 158 lines (+118 / -40) across 1 files Reviewer: florentx Review duration: 69586m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 158 lines diff across 1 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.303
    Real PR Conversation Timeline
    1 comments
    "Review active on #1010"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.3% (MEDIUM) · Higher = larger blast radius
    40.3%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.3% · Safe to merge
    22.3%
    Repository