diff options
author | Robert Haas <rhaas@postgresql.org> | 2015-10-16 09:42:33 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2015-10-16 09:49:08 -0400 |
commit | 26981d292758c6ee9185332e4abc990ff19c81a2 (patch) | |
tree | a3c650b277ace15358b25c15da181e465f242b6d /src/backend/storage | |
parent | a93b3782e3358cbb1ad8d65386a2e1478b805649 (diff) | |
download | postgresql-26981d292758c6ee9185332e4abc990ff19c81a2.tar.gz postgresql-26981d292758c6ee9185332e4abc990ff19c81a2.zip |
Don't send protocol messages to a shm_mq that no longer exists.
Commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d 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.
Diffstat (limited to 'src/backend/storage')
-rw-r--r-- | src/backend/storage/ipc/shm_mq.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/backend/storage/ipc/shm_mq.c b/src/backend/storage/ipc/shm_mq.c index 0e60dbcddc8..c78f1650e6a 100644 --- a/src/backend/storage/ipc/shm_mq.c +++ b/src/backend/storage/ipc/shm_mq.c @@ -746,6 +746,15 @@ shm_mq_detach(shm_mq *mq) } /* + * Get the shm_mq from handle. + */ +shm_mq * +shm_mq_get_queue(shm_mq_handle *mqh) +{ + return mqh->mqh_queue; +} + +/* * Write bytes into a shared message queue. */ static shm_mq_result |