Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changes to help when stop is called during DESTROY rt#111181
The problem: If Test::PostgreSQL dies (external signal, etc) then `stop` gets called from DESTROY. If using pg_ctl style control (Pg9+) and default `base_dir` is used then order of destruction of the File::Temp object and the Test::PostgreSQL object is unpredictable. If the File::Temp object gets destroyed first then when `stop` gets called called during DESTROY the `base_dir` attribute will be undefined and so using pg_ctl to shutdown the database will fail. The solution: In `stop` don't use pg_ctl for shutdown if `base_dir` is undefined and instead shutdown Pg using a signal as per non-pg_ctl control (Pg<9). One additional change is to switch the default signal sent to Pg from SIGTERM to SIGQUIT. See http://www.postgresql.org/docs/9.5/static/server-shutdown.html for details of the different signals. This should make Pg shutdown faster and matches the `stop` mode of shutdown used by pg_ctl. Many thanks to Peter Sergeant (SARGIE) for spotting this issue and for his help explaining the situation.
- Loading branch information
03b3b6b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good -- could you send me a pull request for it and I'll put it into 1.20_04?