[pgpool-committers: 2334] pgpool: pgpool-II has borrowed the Memory and Exception managers from P

Muhammad Usama m.usama at gmail.com
Wed Dec 3 04:47:50 JST 2014


pgpool-II has borrowed the Memory and Exception managers from PostgreSQL which
never utilizes the threads so its APIs are not thread safe. The same is true
for Memory and Exception managers, Some if not all functions of these borrowed
managers use the global variables to remember the current memory context in case
of memory manager and jump to address in case of exception manager. Thus, using
those API functions which manipulate the global variables from thread functions
is not safe and it can lead to undefined behavior or a segmentation fault.

More specifically ereport(ERROR,..), PG_TRY PG_CATCH block and MemoryContextSwitchTo()
calls are stringently off-limit for the thread functions.
Note: all reports () other than ERROR is fine for thread functions.
The commit abstracts all these above mentioned off-limit function calls from
thread function, which were somehow made to the thread function,
When the managers were imported in the pgpool-II.
Few warning messages are also added by the commit to improve the
error reporting of watchdog.

Branch
------
V3_4_STABLE

Details
-------
http://git.postgresql.org/gitweb?p=pgpool2.git;a=commitdiff;h=352195f946199e58a6f28474107df2d64bbaab46

Modified Files
--------------
src/watchdog/watchdog.c  |   21 ++-------------------
src/watchdog/wd_packet.c |   47 +++++++++++++++++++++++++++++++++++++++++-----
src/watchdog/wd_ping.c   |    6 ++++++
3 files changed, 50 insertions(+), 24 deletions(-)



More information about the pgpool-committers mailing list