pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgbf@twiska.com, Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masao.fujii@oss.nttdata.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: min_safe_lsn column in pg_replication_slots view
Date: Thu, 09 Jul 2020 17:56:06 -0400
Message-ID: <2008607.1594331766@sss.pgh.pa.us> (raw)
In-Reply-To: <1773306.1594256635@sss.pgh.pa.us>
References: <20200709005332.GA1986@alvherre.pgsql>
	<1773306.1594256635@sss.pgh.pa.us>

... or on the other hand, maybe these animals are just showing more
sensitivity than others to an actual code bug.  skink is showing
valgrind failures in this very area, on both HEAD and v13:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2020-07-08%2021%3A13%3A02

==3166208== VALGRINDERROR-BEGIN
==3166208== Conditional jump or move depends on uninitialised value(s)
==3166208==    at 0x28618D: KeepLogSeg (xlog.c:9627)
==3166208==    by 0x296AC5: GetWALAvailability (xlog.c:9533)
==3166208==    by 0x4FFECB: pg_get_replication_slots (slotfuncs.c:356)
==3166208==    by 0x3C762F: ExecMakeTableFunctionResult (execSRF.c:234)
==3166208==    by 0x3D9A9A: FunctionNext (nodeFunctionscan.c:95)
==3166208==    by 0x3C81D6: ExecScanFetch (execScan.c:133)
==3166208==    by 0x3C81D6: ExecScan (execScan.c:199)
==3166208==    by 0x3D99A9: ExecFunctionScan (nodeFunctionscan.c:270)
==3166208==    by 0x3C5072: ExecProcNodeFirst (execProcnode.c:450)
==3166208==    by 0x3BD35E: ExecProcNode (executor.h:245)
==3166208==    by 0x3BD35E: ExecutePlan (execMain.c:1646)
==3166208==    by 0x3BE039: standard_ExecutorRun (execMain.c:364)
==3166208==    by 0x3BE102: ExecutorRun (execMain.c:308)
==3166208==    by 0x559669: PortalRunSelect (pquery.c:912)
==3166208==  Uninitialised value was created by a stack allocation
==3166208==    at 0x296A84: GetWALAvailability (xlog.c:9523)
==3166208== 
==3166208== VALGRINDERROR-END

and even the most cursory look at the code confirms that there's a
real bug here.  KeepLogSeg expects *logSegNo to be defined on entry,
but GetWALAvailability hasn't bothered to initialize oldestSlotSeg.
It is not clear to me which one is in the wrong; the comment for
KeepLogSeg isn't particularly clear on this.

			regards, tom lane





view thread (72+ messages)  latest in thread

Message-ID: <2008607.1594331766@sss.pgh.pa.us>
Permalink:  ../2008607.1594331766@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2008607.1594331766@sss.pgh.pa.us

 · 

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: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, alvherre@2ndquadrant.com, horikyota.ntt@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: min_safe_lsn column in pg_replication_slots view
  In-Reply-To: <2008607.1594331766@sss.pgh.pa.us>

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

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