-
Notifications
You must be signed in to change notification settings - Fork 31
Closed
Labels
Description
Environment
PostgreSQL: 17.4 (x86_64 / Linux)
Extensions installed:
Name | Version | Schema | Description
--------------------+---------+------------+------------------------------------------------------------------------
amcheck | 1.4 | public | functions for verifying relation integrity
hypopg | 1.4.1 | public | Hypothetical indexes for PostgreSQL
pg_qualstats | 2.1.1 | public | An extension collecting statistics about quals
pg_stat_kcache | 2.3.0 | public | Kernel statistics gathering
pg_stat_statements | 1.11 | public | track planning and execution statistics of all SQL statements executed
pg_wait_sampling | 1.1 | public | sampling based statistics of wait events
pgaudit | 17.0 | public | provides auditing functionality
plpgsql | 1.0 | pg_catalog | PL/pgSQL procedural languageProblem
When running a CTE query with two subqueries under concurrent load of about 1–2K TPS, backend processes sometimes segfault. The postmaster then kills all backends and triggers crash recovery.
Query:
WITH unseen AS (
SELECT 1
FROM t_events e
WHERE e.user_id = $1
AND e.created_at >= $2
AND e.created_at < $4
LIMIT 100
),
unread AS (
SELECT 1
FROM t_events e
LEFT JOIN t_read_marks m
ON m.user_id = e.user_id
AND m.item_id = e.id
AND m.item_created_at >= $5
AND m.item_created_at < $4
WHERE e.user_id = $1
AND e.created_at >= $3
AND e.created_at < $4
AND m.item_id IS NULL
LIMIT 100
)
SELECT
(SELECT COUNT(*) FROM unread) AS unread_count,
(SELECT COUNT(*) FROM unseen) AS unseen_count;pg log
LOG: server process (PID 877) was terminated by signal 11: Segmentation fault
DETAIL: Failed process was running: [query above]
LOG: terminating any other active server processes
LOG: all server processes terminated; reinitializing
Notes
Crash occurs only with pg_qualstats enabled.
At lower TPS, we haven’t observed a crash; it only happens under ~1–2K TPS load.
pg_qualstats configuration is left at default values, no tuning or adjustments applied.
Please help take a look, thank you!
Reactions are currently unavailable