Skip to content

Connection terminated unexpectedly with postgresql since v2.5.0 #7878

@brunob

Description

@brunob

Hi, sorry to mention an old release, but we are facing this bug since months at infini.fr and we are stuck on 2.4.2.

We use etherpad with postgresql for years and it works well for us. Our setup is a patroni 3 cluster running pgsql 17 accessible on a virtual IP provided by haproxy.

Since version 2.5.0 of etherpad we observe that the service is restarting every 5 minutes with the following error :

[2026-04-28T10:24:21.780] [ERROR] server - Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/opt/etherpad/master/node_modules/.pnpm/pg@8.20.0/node_modules/pg/lib/client.js:180:73)

We've tried to update etherpad to v2.7.2 and the error is the same. We've also cloned the vm, updated nodejs to v24 and tested with latest etherpad 3.2.0, same bug.

In order to narrow the bug, we've tried to bypass haproxy and plugged etherpad directly on the pgsql node which was leader on the cluster. This eliminate the bug. So, we played timeout server & timeout client parameters on haproxy for pgsql backend/fronted and observed that etherpad was restarted every 5 minutes if we apply 5 minutes for theses parameters, and every 30 minutes if we apply 30 minutes for theses parameters.

So, it seems a lib used by etherpad (ueberdb2 or node-postgres) change the way it handles closing of idle connections to pgsql since version 2.5.0. I've seen that this version introduce a bump to ueberdb2 from 5.0.14 to 5.0.15 with f44ee8b which introduce a bump to pg from 8.13.3 to 8.15.1 with ether/ueberDB@90f3ce9 but i can't find any mention to this change of behavior related to this in the issues of these repos.

I've read this porsager/postgres#310 (comment) about haproxy and tcp keep alives but this seems to be enabled by default in node-postgres lib.

Does anyone have faced this kind of bug ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions