Skip to content

ServerDisconnectedError when querying tables created after PostgREST startup since v13+ #4463

@bolinocroustibat

Description

@bolinocroustibat

Description

Since upgrading from PostgREST v12.2.3 to v13.0.8 and v14.0.0, we observe a reproducible issue where some recently created tables cannot be queried through PostgREST.
Requests to these tables fail with a connection abort (ServerDisconnectedError / RemoteDisconnected).

This issue does not occur on v12.2.3.

Context

We run PostgREST as part of a public API gateway (tabular-api.data.gouv.fr) that dynamically exposes a large PostgreSQL database (tens of thousands of tables).
New tables are created regularly, while PostgREST continues to run.

Deployment: Nomad + Consul (Blue/Green, typically 2 instances).

Observed behavior

Starting with v13, queries to some recently created tables fail, while older tables continue to work normally.

From our observations, the problematic tables appear to be tables created after PostgREST has started.

The error is typically:
requests.exceptions.ConnectionError: (‘Connection aborted.’, RemoteDisconnected(‘Remote end closed connection without response’))

Notes:

  • The issue affects only a subset of newly created tables.
  • Tables that already existed at startup behave normally.
  • Restarting PostgREST makes the problematic tables work again — until new tables are created.

This behavior is not present in v12.2.3.

What we’ve tried

  • Restarting PostgREST: temporarily fixes the issue.
  • Purging the number of tables (120k → 55k): no effect.
  • Reverting to v12.2.3: issue disappears entirely.
  • Upgrading to v14.0.0: same behavior as v13.

Environment

  • PostgreSQL: 15.8 (Debian package)
  • PostgREST versions tested:
    • ✅ 12.2.3 — works correctly
    • ❌ 13.0.8 — new tables trigger ServerDisconnectedError
    • ❌ 14.0.0 — same issue
  • Deployment: Nomad + Consul
  • Schema size: ~55K tables (dynamic workload)
  • Requests: hundreds/minute (read-only)

Notes

This suggests a regression introduced in v13 regarding table discovery or schema reloading?

A separate issue we opened describes a continuous memory growth / OOM regression that also appears starting in v13.
We are not sure whether the two problems share a root cause, but both regressions disappear when reverting to v12.

Happy to provide logs if needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions