Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FW][IMP] developer/reference/cli: --limit-time-cron-conn #11822

Closed
wants to merge 1 commit into from

Conversation

fw-bot
Copy link
Collaborator

@fw-bot fw-bot commented Jan 22, 2025

Document the newly created config option.

See: odoo/odoo#194141

Forward-Port-Of: #11779

Document the newly created config option.

See: odoo/odoo#194141
X-original-commit: de2241e
@robodoo
Copy link
Collaborator

robodoo commented Jan 22, 2025

Pull request status dashboard

@fw-bot
Copy link
Collaborator Author

fw-bot commented Jan 22, 2025

@Williambraecky while this was properly forward-ported, at least one co-dependent PR (odoo/odoo#194705) did not succeed. You will need to fix it before this can be merged.

Both this PR and the others will need to be approved via @robodoo r+ as they are all considered “in conflict”.

More info at https://github.com/odoo/odoo/wiki/Mergebot#forward-port

@Williambraecky
Copy link

@robodoo r+

robodoo pushed a commit to odoo/odoo that referenced this pull request Jan 22, 2025
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 wraparound[2]
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 (transaction
   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.
```

[1: LISTEN/NOTIFY](https://www.postgresql.org/docs/current/sql-notify.html)
[2: wraparound](https://www.postgresql.org/docs/current/routine-vacuuming.html#VACUUM-FOR-WRAPAROUND)
[3: VACUUM](https://www.postgresql.org/docs/17/sql-vacuum.html)

[LISTEN/NOTIFY code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c)

[Connection being kept](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L2167-L2191)

[See more](https://www.postgresql.org/message-id/flat/VE1PR03MB531295B1BDCFE422441B15FD92499%40VE1PR03MB5312.eurprd03.prod.outlook.com#7e36d1fdca921b5292e92c7017984ffa)

closes #194705

X-original-commit: 6f774d1
Related: odoo/documentation#11822
Signed-off-by: Julien Castiaux (juc) <[email protected]>
Signed-off-by: William Braeckman (wbr) <[email protected]>
robodoo pushed a commit that referenced this pull request Jan 22, 2025
Document the newly created config option.

closes #11822

See: odoo/odoo#194141
X-original-commit: de2241e
Related: odoo/odoo#194705
Signed-off-by: William Braeckman (wbr) <[email protected]>
@robodoo robodoo closed this Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants