Skip to content

spp_base_common: menu-icon env.ref hook can take down a job worker on a poisoned cursor #383

Description

@gonzalesedwin1123

spp_base_common/models/ir_module_module.py's menu-icon decoration hook calls
self.env.ref(...) during registry load. Two hardening gaps:

  1. env.ref without raise_if_not_found=False — a missing xmlid raises during
    registry load, which is fatal to whatever process is loading the registry.
  2. No tolerance for an aborted transaction: in a recent job-worker incident, a
    UniqueViolation elsewhere poisoned the cursor, and this hook's _xmlid_lookup
    then raised InFailedSqlTransaction on every registry (re)load — repeatedly
    killing the odoo-job-worker thread until the database was quarantined
    (fix(worker): survive a job-level database error instead of quarantining the DB odoo-job-worker#22 hardened the worker side; this is the first-order
    fix). Decorating app menu icons should never be able to take a worker down.

Proposed direction: raise_if_not_found=False plus a defensive try/except around
the lookup that logs and skips decoration on any DatabaseError — cosmetic feature,
best-effort semantics. A regression test that runs the hook on a deliberately
aborted cursor and asserts registry load survives.

Scoped out of OpenSPP/odoo-job-worker#22 by its author.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions