From: | Petr Jelinek <petr(at)2ndquadrant(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | pg_stat_activity crashes |
Date: | 2016-04-20 13:14:16 |
Message-ID: | 571780A8.4070902@2ndquadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I noticed sporadic segfaults when selecting from pg_stat_activity on
current HEAD.
The culprit is the 53be0b1add7064ca5db3cd884302dfc3268d884e commit which
added more wait info into the pg_stat_get_activity(). More specifically,
the following code is broken:
+ proc = BackendPidGetProc(beentry->st_procpid);
+ wait_event_type =
pgstat_get_wait_event_type(proc->wait_event_info);
This needs to check if proc is NULL. When reading the code I noticed
that the new functions pg_stat_get_backend_wait_event_type() and
pg_stat_get_backend_wait_event() suffer from the same problem.
Here is PoC patch which fixes the problem. I am wondering if we should
raise warning in the pg_stat_get_backend_wait_event_type() and
pg_stat_get_backend_wait_event() like the pg_signal_backend() does when
proc is NULL instead of just returning NULL which is what this patch
does though.
--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
Attachment | Content-Type | Size |
---|---|---|
fix-pgstat-proc-null.diff | text/x-diff | 1.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-04-20 13:17:27 | Re: Proposal: Remove regress-python3-mangle.mk |
Previous Message | Amit Langote | 2016-04-20 10:28:40 | Re: Declarative partitioning |