The following bug has been logged on the website:
Bug reference: 13893
Logged by: Chris Bainbridge
Email address: chris.bainbridge@gmail.com
PostgreSQL version: 9.4.5
Operating system: Debian Jessie
Description:
Sometimes on system shutdown postgresql hangs and the log shows:
PANIC: stuck spinlock (0x7f6089f088e0) detected at
/build/postgresql-9.4-CPUoxi/postgresql-9.4-9.4.5/build/../src/backend/storage/buffer/bufmgr.c:1292
or
2016-01-27 19:17:37 GMT [3351-1] PANIC: stuck spinlock (0x7f1de51dc8e0)
detected at
/build/postgresql-9.4-CPUoxi/postgresql-9.4-9.4.5/build/../src/backend/storage/buffer/bufmgr.c:1705
Which causes systemd to hang:
Jan 27 19:16:33 debian postgresql@9.4-main[4959]: pg_ctl: server does not
shut down
Jan 27 19:16:33 debian systemd[1]: postgresql@9.4-main.service: control
process exited, code=exited status=1
Jan 27 19:17:37 debian systemd[1]: postgresql@9.4-main.service: main process
exited, code=exited, status=1/FAILURE
Jan 27 19:17:37 debian systemd[1]: Stopped PostgreSQL Cluster 9.4-main.
Jan 27 19:17:37 debian systemd[1]: Unit postgresql@9.4-main.service entered
failed state.
Jan 27 19:17:37 debian systemd[1]: Stopping system-postgresql.slice.
Sometimes the shutdown continues after a timeout, other times it seems to
hang indefinitely, sysrq-l shows postgres process as
http://imgur.com/kRAtvxw (Linux 4.4 kernel)
A similar bug was reported by another user a few months ago also for 9.4:
http://www.postgresql.org/message-id/20150810204319.2695.22673@wrigleys.postgresql.org