pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: jthompson@maxmind.com
Subject: BUG #16785: Postgresql shutdown during initial pg_prewarm prewarming causes Pg to get stuck
Date: Mon, 21 Dec 2020 21:15:24 +0000
Message-ID: <16785-c0207d8c67fb5f25@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      16785
Logged by:          John Thompson
Email address:      jthompson@maxmind.com
PostgreSQL version: 12.5
Operating system:   Ubuntu Linux
Description:        

We use pg_prewarm via shared_preload_libraries and we've noticed that if we
start Pg then stop it again before pg_prewarm finishes its initial
prewarming, Pg gets stuck in shutdown until we kill the 'autoprewarm master'
process with 'kill -9'. Removing pg_prewarm from shared_preload_libraries
allows Pg to stop without issue. Also, if we start Pg, wait for 'autoprewarm
successfully prewarmed XXXXXX of YYYYYY previously-loaded blocks' to appear
in the logs, then stop, it shuts down as expected.

This is happening on several different servers, but the one I've been
testing on has 855569 lines in
/var/lib/postgresql/12/main/autoprewarm.blocks, 32GB of RAM, and
shared_buffers is 8028MB.

We're using the 12.5 packages from apt.postgresql.org. Normally we use
systemd to start and stop services, but here's an example with just
pg_ctl:

$ sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl start -D
/var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -o
'-c config_file="/etc/postgresql/12/main/postgresql.conf"'
waiting for server to start.... done
server started
$ sudo -u postgres /usr/lib/postgresql/12/bin/pg_ctl stop -s -w -D
/var/lib/postgresql/12/main -m fast
pg_ctl: server does not shut down
$ ps auxwww | grep ^postgres
postgres   448  0.7  0.7 8667168 240252 ?      Ss   21:10   0:01
/usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c
config_file=/etc/postgresql/12/main/postgresql.conf
postgres   455  0.1  0.0 182036  4252 ?        Ss   21:10   0:00 postgres:
logger   
postgres   458  0.0  0.0 8666132 4088 ?        Ss   21:10   0:00 postgres:
checkpointer   
postgres   462  0.0  0.0 185232  5928 ?        Ss   21:10   0:00 postgres:
stats collector   
postgres   463  0.3  0.0 8682976 22740 ?       Ss   21:10   0:00 postgres:
autoprewarm master   
postgres   507  0.0  0.0 8667996 12616 ?       Ss   21:10   0:00 postgres:
walsender repmgr 10.150.0.16(33718) streaming 34A65/4243A5C8
postgres   508  0.0  0.0 8667996 12612 ?       Ss   21:10   0:00 postgres:
walsender repmgr 10.150.0.15(52982) streaming 34A65/4243A5C8
$ sudo kill 463 -9
$ ps auxwww | grep ^postgres
$ 

Please let me know if any other information would be useful, I'm happy to
help. Thanks for any help you can offer.



view thread (5+ messages)  latest in thread

Message-ID: <16785-c0207d8c67fb5f25@postgresql.org>
Permalink:  ../16785-c0207d8c67fb5f25@postgresql.org/
Also on:    postgresql.org/message-id/16785-c0207d8c67fb5f25@postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, jthompson@maxmind.com
  Subject: Re: BUG #16785: Postgresql shutdown during initial pg_prewarm prewarming causes Pg to get stuck
  In-Reply-To: <16785-c0207d8c67fb5f25@postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox