XLogWrite uses palloc within a critical section

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: XLogWrite uses palloc within a critical section
Date: 2018-05-25 04:45:21
Message-ID: 20180525.134521.10026990.horiguchi.kyotaro@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


I happened to see the following in XLogWrite.

> ereport(PANIC,
> (errcode_for_file_access(),
> errmsg("could not seek in log file %s to offset %u: %m",
> XLogFileNameP(ThisTimeLineID, openLogSegNo),
> startoffset)));

where XLogFileNameP calls palloc within, and it is within a
critical section there. So it ends with assertion failure hiding
the PANIC message. We should use XLogFileName instead. The
problem has existed at least since 9.3. The code is frequently
revised so the patch needed to vary into four files.


Kyotaro Horiguchi
NTT Open Source Software Center

Attachment Content-Type Size
fix_xlog_crit_ereports_9_3.patch text/x-patch 4.8 KB
fix_xlog_crit_ereports_9_4-6.patch text/x-patch 4.8 KB
fix_xlog_crit_ereports_10.patch text/x-patch 4.8 KB
fix_xlog_crit_ereports_11b1-master.patch text/x-patch 4.9 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2018-05-25 05:28:05 pg_replication_slot_advance to return NULL instead of 0/0 if slot not advanced
Previous Message Kyotaro HORIGUCHI 2018-05-25 04:19:58 Re: Fix some error handling for read() and errno