Skip to content

Conversation

@Williambraecky
Copy link
Contributor

@Williambraecky Williambraecky commented Mar 12, 2025

Initial PR: #194141

It seems the fix above was not enough as it was assumed that connection (or backend in pg terms) were NOT being reused when initiated through sql_db.connect.

For proper cleanup we need to reach this part of the code which can be done in 3 ways:

  • calling UNLISTEN * and committing
  • closing the connection
  • aborting the transaction (before committing the listen)

UNLISTEN * is a good candidate for this, but closing the connection seems to be the safer option.

@robodoo
Copy link
Contributor

robodoo commented Mar 12, 2025

Pull request status dashboard

@C3POdoo C3POdoo requested review from a team and Julien00859 and removed request for a team March 12, 2025 14:47
@C3POdoo C3POdoo added the RD research & development, internal work label Mar 12, 2025
@kmagusiak
Copy link
Contributor

This would work, but I think the cleaner solution is to close the underlying connection cr._cnx.close() so that it does not get reused in any way.

@Williambraecky Williambraecky force-pushed the 16.0-pg_xact-error-fix-2-wbr branch from 14d9036 to 2b72c07 Compare March 13, 2025 16:06
@Williambraecky Williambraecky force-pushed the 16.0-pg_xact-error-fix-2-wbr branch from 2b72c07 to 967186d Compare March 14, 2025 08:57
Initial PR: odoo#194141

It seems the fix above was not enough as it was assumed that connection
(or backend in pg terms) were NOT being reused when initiated through
`sql_db.connect`.

For proper cleanup we need to reach [this part of the
code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L1260-L1298)
which can be done in 3 ways:
 - calling UNLISTEN * and committing
 - closing the connection
 - aborting the transaction (before committing the listen)

`UNLISTEN *` is a good candidate for this, but closing the connection
seems to be the safer option.
@Williambraecky Williambraecky force-pushed the 16.0-pg_xact-error-fix-2-wbr branch from 967186d to c27fc5c Compare March 14, 2025 08:58
@Williambraecky
Copy link
Contributor Author

@kmagusiak Thanks for reviewing

@robodoo r+

robodoo pushed a commit that referenced this pull request Mar 14, 2025
Initial PR: #194141

It seems the fix above was not enough as it was assumed that connection
(or backend in pg terms) were NOT being reused when initiated through
`sql_db.connect`.

For proper cleanup we need to reach [this part of the
code](https://github.com/postgres/postgres/blob/REL_16_STABLE/src/backend/commands/async.c#L1260-L1298)
which can be done in 3 ways:
 - calling UNLISTEN * and committing
 - closing the connection
 - aborting the transaction (before committing the listen)

`UNLISTEN *` is a good candidate for this, but closing the connection
seems to be the safer option.

closes #201401

Signed-off-by: William Braeckman (wbr) <wbr@odoo.com>
@robodoo robodoo closed this Mar 14, 2025
@fw-bot fw-bot deleted the 16.0-pg_xact-error-fix-2-wbr branch March 21, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RD research & development, internal work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants