Re: Query on pg_stat_activity table got stuck

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: neeraj kumar <neeru.cse@gmail.com>
Cc: Jeremy Schneider <schnjere@amazon.com>, pgsql-admin@postgresql.org, pgsql-general@postgresql.org
Date: 2019-05-10T16:13:58Z
Lists: pgsql-general
neeraj kumar <neeru.cse@gmail.com> writes:
> Also curious why query on pg_stat_activity is considering terminated
> process ?

The short answer to that is that this bug leaves shared memory in
a corrupt state.  It's not really useful to worry about whether
readers should react differently to that --- you could spend endless
amounts of time hypothesizing different kinds of corruption and
endless amounts of code/cycles trying to work around it.  But the
right answer is to fix it on the writing side.

			regards, tom lane



Commits

  1. Rearrange pgstat_bestart() to avoid failures within its critical section.

  2. Fix union for pgstat message types