odoo/odoo#194705
Created by fw-bot
Statuses:
- legal/cla: Contributor License Agreement check
- ci/runbot: Odoo Test Suite
- ci/upgrade_enterprise: Test upgrades for enterprise master
- ci/template: Contact runbot team on discord for help.
- ci/style: Optional style check. Ignore it only if strictly necessary.
- ci/security: Required security check. Can only be ignored by security team.
- label
- odoo-dev:17.0-16.0-cron-conn-time-opt-wbr-DoJv-fw
- head
- 1718122c933a41c89da2e06dd0e41de46da46896
- merged
- 5 months ago by William Braeckman (wbr)
odoo/odoo | odoo/documentation | |
---|---|---|
16.0 | #194141 | #11779 |
17.0 | #194705 | #11822 |
saas-17.2 | #194742 | #11824 |
saas-17.4 | #194822 | #11831 |
18.0 | #194937 | #11835 |
saas-18.1 | #194957 | #11843 |
saas-18.2 | ||
saas-18.3 | ||
master | #195042 | #11851 |
[FW][IMP] odoo: add config for cron connection time
Adds a configuration that can be used to mitigate PostgreSQL
transactional errors with long-living connections and the
LISTEN/NOTIFY
1 functionality by re-establishing the database
connection periodically.
In the case that a connection outlives the transaction wraparound2
mechanism of postgres, the LISTEN/NOTIFY
internal queue might contain
references to transactions that have already been deleted by the
system's (or a manual) VACUUM
3 as it has its own transaction
validity mechanisms (roughly comparing transaction ids).
This can be reproduced by:
- Triggering a wraparound AND cleaning of pg_xact between the cron's
LISTEN
+ COMMIT
and its recyling.
- Having done at least one NOTIFY
during that time period (?).
- Try to LISTEN
to the same channel on the same database (transcation
id must be < than the first connection's transaction id).
The following is an example error message:
ERROR database odoo.service.server: Worker (3194772) Exception occurred, exiting...
Traceback (most recent call last):
File "/home/user/odoo/service/server.py", line 1089, in run
self.start()
File "/home/user/odoo/service/server.py", line 1235, in start
self.dbcursor.commit()
File "/home/user/odoo/sql_db.py", line 480, in commit
result = self._cnx.commit()
^^^^^^^^^^^^^^^^^^
psycopg2.errors.UndefinedFile: could not access status of transaction 1194816979
DETAIL: Could not open file "pg_xact/0473": No such file or directory.
Forward-Port-Of: #194141
-
https://www.postgresql.org/docs/current/sql-notify.html ↩
-
https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND ↩
-
https://www.postgresql.org/docs/17/sql-vacuum.html ↩