[v0.29.8] [Bug]: postgres.js 3.4.4 schedules negative reconnect timeouts, emitting TimeoutNegativeWarning in the core process logs
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- docker, postgresql, typescript
調査の方向性
Start by checking the postgres versions in packages/server/package.json and apps/dokploy/package.json, then inspect the lockfile entries for the same dependency. The issue identifies the fix as updating both declarations from 3.4.4 to 3.4.8 and updating the lockfile; done means the resolved versions are 3.4.8 and the warning no longer appears on reconnect.
索引モデルが issue の本文から書いたものです。
説明
To Reproduce
-
Run any Dokploy instance (self-hosted, single node is enough). No applications
need to be deployed. -
Follow the core process logs:
docker service logs -f dokploy(Swarm) or
docker logs -f <dokploy-container>. -
Force the pooled Postgres connection to drop and be reused after an idle gap.
On a Swarm install:docker service scale dokploy-postgres=0 # keep the panel open / click around for ~25 s so the pool notices the drop docker service scale dokploy-postgres=1 -
The next query that reuses that pooled connection prints:
(node:53) TimeoutNegativeWarning: -19224216.33660932 is a negative number. Timeout duration was set to 1.The magnitude is how long the connection had been sitting closed in the pool —
-19224216ms is 5 h 20 min. The longer the instance has been up, the larger it
gets.
A driver-level reproduction that does not need a Dokploy instance at all:
docker run -d --name pgrepro -e POSTGRES_PASSWORD=repro -e POSTGRES_DB=repro \
-p 55432:5432 postgres:16
// node repro.mjs, with [email protected] installed
import postgres from "postgres";
const sql = postgres("postgres://postgres:[email protected]:55432/repro", { max: 1 });
const admin = postgres("postgres://postgres:[email protected]:55432/repro", { max: 1 });
process.on("warning", (w) => console.log("WARNING:", w.name, w.message));
await sql`select 1`;
const [{ pid }] = await sql`select pg_backend_pid() as pid`;
await admin`select pg_terminate_backend(${pid})`;
await new Promise((r) => setTimeout(r, 50)); // idle past the 5-30 ms backoff
await sql`select 2`.catch(() => {});
On [email protected] this prints TimeoutNegativeWarning; on [email protected] it
does not.
Current vs. Expected behavior
Current: the core process periodically logs TimeoutNegativeWarning with a
large negative value. It comes from postgres.js 3.4.4, src/connection.js:353:
setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0)
closedDate is stamped when a pooled connection closes and is never reset, while
the default backoff is only 5–30 ms. Any connection reused more than a few
milliseconds after it closed therefore schedules a negative timeout, which Node
clamps to 1 ms and warns about. Dokploy calls postgres(dbUrl) with defaults,
including a max_lifetime of 30–60 min, so pooled connections do close and get
reused in normal operation.
Expected: no TimeoutNegativeWarning in the logs. The upstream clamp first
ships in postgres.js 3.4.8
(porsager/postgres@3ffc3c4).
Severity: low — this is log noise, not a performance problem. Worth stating
explicitly, because this warning was originally reported in #4661 together with
CPU spikes and the two turned out to be unrelated. The negative value replaces a
5–30 ms backoff with an immediate retry, once per reconnect — it is not a
loop. Measured over 150 forced reconnect cycles, three paired runs:
[3.4.4] 150 reconnect cycles | wall 11915ms | cpu 1795ms | 15.1% of one core | TimeoutNegativeWarning=1
[3.4.8] 150 reconnect cycles | wall 11758ms | cpu 1789ms | 15.2% of one core | TimeoutNegativeWarning=0
[3.4.4] 150 reconnect cycles | wall 12237ms | cpu 1815ms | 14.8% of one core | TimeoutNegativeWarning=1
[3.4.8] 150 reconnect cycles | wall 11821ms | cpu 1725ms | 14.6% of one core | TimeoutNegativeWarning=0
[3.4.4] 150 reconnect cycles | wall 11926ms | cpu 1667ms | 14.0% of one core | TimeoutNegativeWarning=1
[3.4.8] 150 reconnect cycles | wall 11720ms | cpu 1722ms | 14.7% of one core | TimeoutNegativeWarning=0
Identical within noise (1759 ms vs 1745 ms mean), and note the warning fires once
per 150 cycles, not once per cycle. Filing this only so the remaining half of
#4661 stays tracked after the CPU fix lands.
Provide environment information
Dokploy: reproduced in-situ on v0.29.4 (dokploy/dokploy:v0.29.4), self-hosted Swarm, single node
Affected dependency is unchanged on canary today:
packages/server/package.json -> "postgres": "3.4.4"
apps/dokploy/package.json -> "postgres": "3.4.4"
(3.4.7 also ships transitively and is still unfixed; the clamp lands in 3.4.8)
OS: Ubuntu, kernel 5.15.0 x86_64
Docker Engine: Swarm mode, single manager node
Driver-level repro is version-independent: [email protected] vs [email protected] against postgres:16
Which area(s) are affected? (Select all that apply)
Databases
Are you deploying the applications where Dokploy is installed or on a remote server?
Same server where Dokploy is installed
Additional context
This is the second of the two symptoms bundled in #4661. The CPU half of that
report has a separate root cause (overlapping docker stats polls in
apps/dokploy/server/wss/docker-stats.ts) and is fixed by #5011; the postgres
bump was deliberately dropped from that PR to keep it focused, which is why this
one exists.
Fix is a dependency bump only: postgres 3.4.4 → 3.4.8 in
packages/server/package.json and apps/dokploy/package.json, plus the lockfile.
Verified in-situ by rebuilding the v0.29.4 image with only postgres.js replaced
and rolling it into the Swarm service — the warning was gone and the panel worked
normally.
Will you send a PR to fix it?
No
- 主要言語
- TypeScript
- スター
- 38.8k
- フォーク
- 3.2k
- 平均マージ
- 1日 10時間
- マージ済み PR(30日)
- 110
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Dokploy/dokploy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Dokploy/dokploy#6151 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Healthy Swarm task shows an empty `(Error:)` suffix on the last row of the Containers tab対応中かも @AyhamJo7 が 4 日前に担当しました。 オープンneeds-triage🔍
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
Dokploy/dokploy#6115 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Global search (Cmd/Ctrl+J) never sorts results by relevance対応中かも @hamidzr が 6 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Dokploy/dokploy#6107 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`utils/dns/ovh.ts`: the zone-listing 403 handler replaces the provider's error instead of chaining it対応中かも @SyncWithRaj が 8 日前に担当しました。 オープンbug
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
Dokploy/dokploy#6075 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
MongoDB with Replica Sets enabled: container exits with code 0 and restarts in a loop (generated startup script never waits on mongod)対応中かも @ghazy2001 が 10 日前に担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
Dokploy/dokploy#6051 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
Dokploy/dokploy の issue をすべて見る
似ている issue
-
[Bug]: RUN_STARTED resets the run's tool-call tally even when a subscriber suppresses the eventオープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
ag-ui-protocol/ag-ui#3504 ·
メンテナーはふだん 1 日以内に返信
-
area/profiles area/sessions comp/desktop desktop/chat desktop/sessions P2 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
NousResearch/hermes-agent#161712 ·
メンテナーはふだん 1 日以内に返信
-
bug p3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
rothgar/rabble.radio#283 ·
メンテナーはふだん 1 日以内に返信
-
bug from-app needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
nightly-labs/openbot#19805 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
OHDSI/Data2Evidence#3760 ·
メンテナーはふだん 3 日以内に返信