mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Fix crash in autoprewarm.
Commit abb0b4fc03
moved the shared state for autoprewarm to a
dynamic shared memory (DSM) segment, but it left apw_detach_shmem()
in the on_shmem_exit callback list for the autoprewarm leader
process. This is a problem because shmem_exit() detaches all the
DSM segments prior to calling the on_shmem_exit callbacks, thus
producing segfaults in the exit path for the autoprewarm leader
process.
To fix, move apw_detach_shmem() to the before_shmem_exit callback
list. This commit also adds a check to pg_prewarm's test that the
server shut down normally. It might be worth making this a common
check for all shutdowns in TAP tests, but that is left as a future
exercise.
Reported-by: Andres Freund
Reviewed-by: Andres Freund, Álvaro Herrera
Discussion: https://postgr.es/m/20240122204117.swton324xcoodnyi%40awork3.anarazel.de
This commit is contained in:
@ -55,4 +55,10 @@ $node->wait_for_log(
|
||||
|
||||
$node->stop;
|
||||
|
||||
# control file should indicate normal shut down
|
||||
command_like(
|
||||
[ 'pg_controldata', $node->data_dir() ],
|
||||
qr/Database cluster state:\s*shut down/,
|
||||
'cluster shut down normally');
|
||||
|
||||
done_testing();
|
||||
|
Reference in New Issue
Block a user