sql-pg: pool is not closed when the "SELECT 1" readiness probe fails in PgClient.make
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- postgresql, typescript
- 領域
- database
調査の方向性
packages/sql/pg/src/PgClient.ts の PgClient.make から始め、プールの作成、SELECT 1 の取得、release finalizer を追跡します。readiness probe の失敗経路を確認し、そこで構築されたプールが終了されるようにしつつ、取得に成功した場合の既存のクリーンアップ動作を維持してください。
索引モデルが issue の本文から書いたものです。
説明
Package
@effect/sql-pg 0.53.0 (the same structure is present in the v4 sources at packages/sql/pg/src/PgClient.ts).
Description
In PgClient.make, the pg.Pool is constructed before the acquisition effect:
const pool = new Pg.Pool({ ... })
pool.on("error", () => {})
yield* Effect.acquireRelease(
Effect.tryPromise({
try: () => pool.query("SELECT 1"),
catch: (cause) => new SqlError({ ... })
}),
() => Effect.promise(() => pool.end()).pipe(...)
).pipe(...)
Per Effect.acquireRelease semantics, the release finalizer is registered only after a successful acquire — so when the SELECT 1 readiness probe fails, pool.end() is never called and the already-constructed pool object is orphaned.
Impact
Small in practice (pg pools are lazy — a pool that never acquired a client holds no sockets or timers, so the orphaned object is garbage-collectable), but:
- callers that retry a failed layer build (e.g. a self-healing wrapper around
ManagedRuntimethat replaces the runtime after a failed build) accumulate pool instances across attempts, - the
pool.end()finalizer signals the intent to always release the pool, so a failed probe silently violating that contract is surprising.
Suggested fix
End the pool when the probe fails, e.g.:
Effect.acquireRelease(
Effect.tryPromise({
try: () => pool.query("SELECT 1"),
catch: (cause) => new SqlError({ ... })
}).pipe(Effect.tapErrorCause(() => Effect.promise(() => pool.end()))),
() => ...
)
or construct the pool inside the acquire effect.
- 主要言語
- TypeScript
- スター
- 16.7k
- フォーク
- 808
- 平均マージ
- 11時間 3分
- マージ済み PR(30日)
- 840
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Effect-TS/effect のほかの issue
-
`Schedule.fixed` repeats with no delay when the clock is a tiny fraction before a boundary対応中かも @effect-bot が 1 日前に担当しました。 オープン
Effect-TS/effect#10250 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Cluster: A way to remove processed requests from storage対応中かも @effect-bot が 1 日前に担当しました。 オープンenhancement
Effect-TS/effect#10239 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Cluster: an interrupted request whose handler dies stalls every other entity on the runner対応中かも @effect-bot が 1 日前に担当しました。 オープンbug
Effect-TS/effect#10238 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Let OTLP log and trace exporters leave no timer pending while idle対応中かも @effect-bot が 2 日前に担当しました。 オープン
Effect-TS/effect#10234 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
Otlp.layerFromConfig exports nothing when only OTEL_EXPORTER_OTLP_ENDPOINT is set対応中かも @effect-bot が 2 日前に担当しました。 オープン
Effect-TS/effect#10231 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
Effect-TS/effect の issue をすべて見る
似ている issue
-
Add: Class TV Modaオープンcheck:passed streams:add
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
GiganticMinecraft/seichi-playguide#183 ·
メンテナーはふだん 1 日以内に返信
-
area: core complexity: easy impact: medium
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
ueberdosis/tiptap#8668 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
longbridge/nsh#804 ·
メンテナーはふだん 1 日以内に返信