Compatibility: preserve root cause on connection timeouts with PG16 parameters

Open
#641 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
18/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
postgresql, python
Domain
databases

Research direction

The issue names no file, function or test. Start by reproducing the problem with a multi-host PostgreSQL DSN that uses target_session_attrs or sslnegotiation, and find where the connection fallback loop catches and re-raises errors. Done would mean the original timeout is chained or preserved in the traceback, which the maintainers would need to agree on first, since the expected behaviour is not yet specified.

Written by the indexing model from the issue text.

Description

Hi everyone,

While working with PostgreSQL 16 multi-host DSNs that utilize newer connection parameters like target_session_attrs or sslnegotiation, we noticed that fallback connection attempts can sometimes obscure the original root cause during network timeouts. This can occasionally make diagnosing connectivity issues in clustered environments a bit trickier than necessary.

Environment
  • Python 3.12
  • Linux / Ubuntu 22.04
  • OCA/rest-framework (current main)
  • psycopg / psycopg2 (PostgreSQL 16 connection handling)
Steps to Reproduce
  1. Configure a multi-host PostgreSQL DSN in Odoo utilizing target_session_attrs=read-write or sslnegotiation=direct.
  2. Simulate a network timeout or unreachable primary node where fallback logic is triggered.
  3. Observe the resulting exception traceback.
Expected Behavior

The underlying root cause and original timeout exception should be preserved or clearly chained in the traceback to facilitate faster debugging.

Actual Behavior

The original network timeout context can sometimes be swallowed during the fallback iteration across connection attempts.

Happy to submit a quick PR for this if the maintainers are open to it!


Reported by Usman Ghias · Senior Systems & Backend Architect · Open for Select Senior Remote & Consulting Roles

Dominant language
Python
Stars
385
Forks
393
Avg merge
4d 22h
Merged PRs (30d)
21

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/rest-framework

All issues in OCA/rest-framework

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.