pgsql: Fix walsender error cleanup code

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix walsender error cleanup code
Date: 2020-05-16 00:02:19
Message-ID: E1jZkHT-0001cv-AL@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix walsender error cleanup code

In commit 850196b610d2 I (Álvaro) failed to handle the case of walsender
shutting down on an error before setting up its 'xlogreader' pointer;
the error handling code dereferences the pointer, causing a crash.
Fix by testing the pointer before trying to dereference it.

Kyotaro authored the code fix; I adopted Nathan's test case to be used
by the TAP tests and added the necessary PostgresNode change.

Reported-by: Nathan Bossart <bossartn(at)amazon(dot)com>
Author: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Author: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Discussion: https://postgr.es/m/C04FC24E-903D-4423-B312-6910E4D846E5@amazon.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1d3743023ef8fa665902e791b0d52e9a1ab419cb

Modified Files
--------------
src/backend/replication/walsender.c | 2 +-
src/test/perl/PostgresNode.pm | 17 +++++++++++++++--
src/test/recovery/t/006_logical_decoding.pl | 13 +++++++++++--
3 files changed, 27 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2020-05-16 01:48:00 pgsql: Change locktype "speculative token" to "spectoken".
Previous Message Tom Lane 2020-05-15 23:56:08 pgsql: Drop the redundant "Lock" suffix from LWLock wait event names.