RE: ReplicationSlotRelease() crashes when the instance is in the single user mode
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Michael Paquier' <michael@paquier.xyz>
Cc: 'Paul A Jungwirth' <pj@illuminatedcomputing.com>, Mutaamba Maasha <maasha@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>, "David G.
Johnston" <david.g.johnston@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, Tom Lane <tgl@sss.pgh.pa.us>, Bertrand Drouvot <bertranddrouvot.pg@gmail.com>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>
Date: 2025-08-19T12:52:24Z
Lists: pgsql-hackers
Attachments
- regress_log_049_slots_in_single_user_mode.txt (text/plain)
- v7-0001-Set-ReplicationSlot-active_pid-even-in-single-use.patch (application/octet-stream) patch v7-0001
- v7-0002-Prohibit-slot-manipulation-while-in-single-user-m.patch (application/octet-stream) patch v7-0002
Dear Michael, > You could also validate that using the CI, assuming that you have a > cloned repo on github with the CI enabled. See src/tools/ci/README. > I use that a lot with local branches for pre-commit validations where > things could break across the board. I have run the tests on my CI and found that windows cannot accept the test. Per attached output, starting the postgres with the single-user mode was failed because the user had admin permissions [1]. However, pg_ctl start command could be done by the same user. I'm not familiar with Windows, but according to your blogpost [2], Windows seems to allows running some server command by generating the restricted context for running postgres commands. In case of single-user mode, however, we directly run the given command with the current user. So, there is a possibility that only instance can boot only by pg_ctl. Based on that, I want to skip the test on windows platform rather than modifying the ci environment. IIUC, other tests which uses --single cannot work on windows as well. > Hmm. src/test/modules/test_misc/ makes more sense to me here. (No > need to send an updated patch just for that.) I did not notice the directory and looked nice. Updated. [1]: ``` # Running: postgres --single -F -c exit_on_error=true -D C:\cirrus\build/testrun/recovery/049_slots_in_single_user_mode\data/t_049_slots_in_single_user_mode_node_data/pgdata postgres Execution of PostgreSQL by a user with administrative permissions is not permitted. The server must be started under an unprivileged user ID to prevent possible system security compromises. See the documentation for more information on how to properly start the server. ``` [2]: https://paquier.xyz/postgresql-2/postgres-utilities-restricted-token/ Best regards, Hayato Kuroda FUJITSU LIMITED
Commits
-
Fix assertion failure with replication slot release in single-user mode
- 8ed079cad824 13.23 landed
- 32d388d00f9f 14.20 landed
- 818be9b73c94 15.15 landed
- fea1cc3f75ff 16.11 landed
- 07a302387176 17.7 landed
- ea1c6b0b0aec 18.0 landed
- 1f2e51e3c7c2 19 (unreleased) landed