mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Don't send protocol messages to a shm_mq that no longer exists.
Commit 2bd9e412f9
introduced a mechanism
for relaying protocol messages from a background worker to another
backend via a shm_mq. However, there was no provision for shutting
down the communication channel. Therefore, a protocol message sent
late in the shutdown sequence, such as a DEBUG message resulting from
cranking up log_min_messages, could crash the server. To fix, install
an on_dsm_detach callback that disables sending messages to the shm_mq
when the associated DSM is detached.
This commit is contained in:
@@ -65,6 +65,9 @@ extern void shm_mq_set_handle(shm_mq_handle *, BackgroundWorkerHandle *);
|
||||
/* Break connection. */
|
||||
extern void shm_mq_detach(shm_mq *);
|
||||
|
||||
/* Get the shm_mq from handle. */
|
||||
extern shm_mq *shm_mq_get_queue(shm_mq_handle *mqh);
|
||||
|
||||
/* Send or receive messages. */
|
||||
extern shm_mq_result shm_mq_send(shm_mq_handle *mqh,
|
||||
Size nbytes, const void *data, bool nowait);
|
||||
|
Reference in New Issue
Block a user