basquetWi + New ticket
pluto PLUTO-747

statement_timeout proconfig on bundle fns never fires; enforce via SET LOCAL

Done high cpcoder-pluto-cc

Per-function proconfig statement_timeout (mig 047 PLUTO-471, 119 PLUTO-666) does not bound the calling statement: the timer is armed at statement start with the session value (120 s for role postgres) before the function's SET applies. Measured 2026-09-20 on an isolated PG17: 3 s pg_sleep inside a function with statement_timeout='1s' completes under session 0 and 120 s; the same call after SET LOCAL statement_timeout=1000 in the same transaction is cancelled (57014); session-level 1 s also cancels (control). Prod evidence: fn_getInformesBundle 23.26 s / 11.12 s at 2026-09-19 17:01:41Z/43Z with the 4 s proconfig present, /informes 500 (appEvents 52f9443f, dd6d3c28). So the PLUTO-471 pool-cascade bound has never been in force since 2026-07-02, and 119's comment calling statement_timeout load-bearing was wrong. Fix: queryWithStatementTimeout in src/db/pool.ts (BEGIN; SET LOCAL statement_timeout=4000; call; COMMIT, ROLLBACK+release(true) on failure) used by getInformesBundle/getAlumnoDetailBundle/getPracticasBundle; 5 mocked-client tests. Consequence to state: calls between 4 s and the old 120 s that used to succeed slowly now 500 at 4 s. NOT verified: prod PG major version; cancel behaviour was measured on PG17 only. Ships with the next app push.

Sub-tickets

No sub-tickets.
+ Add sub-ticket

Activity

  • wi-cli-venus created · 3w ago
  • wi-cli-venus note · 3w ago
    SHIPPED per pmmaster ruling (Elazar behalf) 2026-09-20: 30 s SET LOCAL on the three bundle getters + [bundle-duration] fn/ms/outcome stdout line on every call. Live: /api/health 17:20:43Z version 2.23.97 dpl_AxXrRnSSpt9Vg4JfjiafkQpR1H8v dbOk true. NOT yet observed: a [bundle-duration] line in Vercel runtime logs (needs a real /informes, /alumnos detail or /practicas load) and a real 57014 cancel in prod. Prod PG 17.6 (db-pluto-cc select version()). Pushed via flock lane; audit-general review requested by pmmaster. Follow-up PLUTO-748 (why 5-30 s, tighten from measured p99). Keep open until one duration line is seen.
  • coder-pluto-cc note · 1w ago
    closed by pmmaster ruling: code fix confirmed shipped+intact since 2026-09-20 (src/db/pool.ts:78-115, 30s SET LOCAL + [bundle-duration] log on 3 bundle getters). Runtime-log sighting gate unverifiable (EVO-104 403 on get_runtime_logs, confirmed live this session) - not held open on an unobservable gate per pmmaster directive.
  • coder-pluto-cc completed · 1w ago
    completed
bug
3w ago by wi-cli-venus
1w ago
2026-10-04 21:31