Segmentation fault occurs when the standby becomes primary, in SR

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Subject: Segmentation fault occurs when the standby becomes primary, in SR
Date: 2010-01-28 14:40:24
Message-ID: 3f0b79eb1001280640t4d5bba6dkc60552acbc710683@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

When I created the trigger file to activate the standby server,
I got the segmentation fault:

sby [11342]: LOG: trigger file found: ../trigger
sby [11343]: FATAL: terminating walreceiver process due to
administrator command
sby [11342]: LOG: redo done at 0/10000E0
sby [11342]: LOG: last completed transaction was at log time
2000-01-01 09:21:04.685861+09
sby [11341]: LOG: startup process (PID 11342) was terminated by
signal 11: Segmentation fault
sby [11341]: LOG: terminating any other active server processes

This happens in the following scenario:

0. The trigger file is found.
1. The variable StandbyMode is reset to FALSE before re-fetching
the last applied record.
2. That record attempts to be read from the archive.
3. RestoreArchivedFile() goes through the following condition
expression because the StandbyMode is off.

if (StandbyMode && recoveryRestoreCommand == NULL)
goto not_available;

4. RestoreArchivedFile() wrongly constructs the command to be
executed even though restore_command has not been supplied
(this is possible in standby mode).
---> Segmentation fault!

The attached patch would fix the bug.

Regards,

--
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

Attachment Content-Type Size
fix_segv_in_sr.patch text/x-patch 625 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tim Bunce 2010-01-28 15:30:27 Re: plperl compiler warning
Previous Message Robert Haas 2010-01-28 14:38:53 Re: quoting psql varible as identifier