[Pkg-postgresql-public] Bug#759725: #759725: postgresql-common: non-synchronous service postgresql start/stop/reload

beuc at debian.org beuc at debian.org
Wed Apr 8 15:03:59 UTC 2015


Control: severity -1 serious

Hi,

I need to introduce "sleep 1"'s in FusionForge to work-around this
issue, so I believe this is not on par with Debian quality standards
for a release.  I'm raising the severity to "serious" accordingly.

For reference, this issue is not present in CentOS7, while they
migrated to systemd (their .service is attached).

Regards,
Sylvain

On Wed, Mar 11, 2015 at 05:44:34PM +0100, beuc at debian.org wrote:
> Hi,
> 
> I currently get a race condition when stopping postgresql and backing
> up /var/lib/postgresql.  We use this backup to quickly reset the DB to
> a saved state in a lenghty testsuite.
> 
> cp: cannot stat '/var/lib/postgresql/9.4/main/postmaster.pid': No such file or directory
> 
> In other words, the init system tells me postgresql is properly down,
> I even have additional tests in my script to try and connect to the DB
> to ensure the service is actually down, but really the service is
> still up, and the .pid file is eventually removed in the background by
> the init system, during the 'cp'.
> 
> Can you make the 'stop' procedure synchronous as well ?
> 
> - Sylvain
> 
> 
> On Wed, Oct 08, 2014 at 12:04:33PM +0200, beuc at debian.org wrote:
> > Hi,
> > 
> > Thanks for the recent patch.
> > 
> > - It fixes 'start' and 'restart'.
> >   I'm not sure about 'reload' but I couldn't make it fail, so OK :)
> > 
> > - However 'stop' is not fixed (still async).
> > 
> > - Also after
> >   service postgresql stop ; rm -rf /var/lib/postgresql ; service postgresql start
> >   -> 'status' will still happily declare the service 'active'
> > 
> > These tests show the bug is not completely fixed, so I'm reopening it.
> > 
> > Cheers!
-------------- next part --------------
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades.  If you want to customize, the
# best way is to create a file "/etc/systemd/system/postgresql.service",
# containing
#	.include /lib/systemd/system/postgresql.service
#	...make your changes here...
# For more info about custom unit files, see
# http://fedoraproject.org/wiki/Systemd#How_do_I_customize_a_unit_file.2F_add_a_custom_unit_file.3F

# For example, if you want to change the server's port number to 5433,
# create a file named "/etc/systemd/system/postgresql.service" containing:
#	.include /lib/systemd/system/postgresql.service
#	[Service]
#	Environment=PGPORT=5433
# This will override the setting appearing below.

# Note: changing PGPORT or PGDATA will typically require adjusting SELinux
# configuration as well; see /usr/share/doc/postgresql-*/README.rpm-dist.

# Note: do not use a PGDATA pathname containing spaces, or you will
# break postgresql-setup.

# Note: in F-17 and beyond, /usr/lib/... is recommended in the .include line
# though /lib/... will still work.

[Unit]
Description=PostgreSQL database server
After=network.target

[Service]
Type=forking

User=postgres
Group=postgres

# Port number for server to listen on
Environment=PGPORT=5432

# Location of database directory
Environment=PGDATA=/var/lib/pgsql/data

# Where to send early-startup messages from the server (before the logging
# options of postgresql.conf take effect)
# This is normally controlled by the global default set by systemd
# StandardOutput=syslog

# Disable OOM kill on the postmaster
OOMScoreAdjust=-1000

ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300
ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast
ExecReload=/usr/bin/pg_ctl reload -D ${PGDATA} -s

# Give a reasonable amount of time for the server to start up/shut down
TimeoutSec=300

[Install]
WantedBy=multi-user.target


More information about the Pkg-postgresql-public mailing list