agora inbox for pgpool-committers@postgresql.org  
help / color / mirror / Atom feed
From: Tatsuo Ishii <ishii@postgresql.org>
To: pgpool-committers@lists.postgresql.org
Subject: pgpool: Add volatile qualifier.
Date: Tue, 21 Jul 2026 12:02:02 +0000
Message-ID: <E1wm9Ag-00000005glY-3nnN@gothos.postgresql.org> (raw)

Add volatile qualifier.

In Pgpool-II main, local pointer array "my_backend_status" is not
volatile qualified, while it should have been.
Also in initialize_shared_mem_objects() and sync_backend_from_watchdog():

        my_backend_status[i] = &(BACKEND_INFO(i).backend_status);

should have been:

        my_backend_status[i] = (volatile BACKEND_STATUS *) &(BACKEND_INFO(i).backend_status);

Without these volatile qualifiers, *(my_backend_status[i]) could read
state value because of compiler optimization. Since
my_backend_status[i] is referred to in popular VALID_BACKEND macro, we
should fix it in all supported branches.

Author: Tatsuo Ishii <ishii@postgresql.org>
Discussion: https://www.postgresql.org/message-id/20260701.101148.451717746326656928.ishii%40postgresql.org
Backpatch-through: v4.3

Branch
------
master

Details
-------
https://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=c2d464521ef017fd7aa76fc56c412c5af06fd...

Modified Files
--------------
src/include/pool.h     |  2 +-
src/main/pgpool_main.c | 13 +++++++++----
2 files changed, 10 insertions(+), 5 deletions(-)



view thread (6+ messages)

Message-ID: <E1wm9Ag-00000005glY-3nnN@gothos.postgresql.org>
Permalink:  ../E1wm9Ag-00000005glY-3nnN@gothos.postgresql.org/
Also on:    postgresql.org/message-id/E1wm9Ag-00000005glY-3nnN@gothos.postgresql.org

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgpool-committers@postgresql.org
  Cc: ishii@postgresql.org, pgpool-committers@lists.postgresql.org
  Subject: Re: pgpool: Add volatile qualifier.
  In-Reply-To: <E1wm9Ag-00000005glY-3nnN@gothos.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox