Commits on Aug 21, 2026
-
Cleanup after failed shared memory request after startup
If allocation or initialization of a requested shared memory area failed, CallShmemCallbacksAfterStartup() did not clear pending_shmem_requests List and reset shmem_request_state. If the list was allocated in a memory context which is cleared by error handler, pending_shmem_requests would point to non-existent memory. Next call to CallShmemCallbacksAfterStartup() would result in an Assertion failure or a crash. The stale state meant that the later shared memory requests are not processed immediately. Fix this by making CallShmemCallbacksAfterStartup() cleanup after the failure. Document that shared areas allocated before such an error remain allocated but uninitialized. The requesting subsystem should not use such areas. Ideally, we should remove the uninitialized areas and free their memory. But the fix is too invasive to be applied late in the PG 19 release cycle. Reported-by: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Author: Ayush Tiwari <ayushtiwari.slg01@gmail.com> Author: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> Discussion: https://www.postgresql.org/message-id/CAJTYsWVRRWH48=PcuAo_2Y4Ap6M0QRmzxgUfFkNRtdWK74LjBQ@mail.gmail.com