aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/parallel.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-10-16 09:42:33 -0400
committerRobert Haas <rhaas@postgresql.org>2015-10-16 09:42:33 -0400
commit2ad5c27bb565c26a4b12ea3343331c80f121f269 (patch)
tree9e4541141b2ea1870ac1097d40777c20fcbba2ea /src/backend/access/transam/parallel.c
parent3587cbc34fe87e1bde6c202daba791b68e44cb3a (diff)
downloadpostgresql-2ad5c27bb565c26a4b12ea3343331c80f121f269.tar.gz
postgresql-2ad5c27bb565c26a4b12ea3343331c80f121f269.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/access/transam/parallel.c')
-rw-r--r--src/backend/access/transam/parallel.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c
index 29d6ed57cc2..0b94c0f87e9 100644
--- a/src/backend/access/transam/parallel.c
+++ b/src/backend/access/transam/parallel.c
@@ -867,7 +867,7 @@ ParallelWorkerMain(Datum main_arg)
ParallelWorkerNumber * PARALLEL_ERROR_QUEUE_SIZE);
shm_mq_set_sender(mq, MyProc);
mqh = shm_mq_attach(mq, seg, NULL);
- pq_redirect_to_shm_mq(mq, mqh);
+ pq_redirect_to_shm_mq(seg, mqh);
pq_set_parallel_master(fps->parallel_master_pid,
fps->parallel_master_backend_id);