Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: Adding REPACK [concurrently]
Date
Msg-id 202604070821.zkcnhnor3oto@alvherre.pgsql
Whole thread Raw
In response to Re: Adding REPACK [concurrently]  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On 2026-Apr-07, Tom Lane wrote:

> Maybe you saw this already, but BF member skink is failing on
> src/test/modules/injection_points/specs/repack.spec:
> 
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2026-04-06%2022%3A50%3A41

Thanks, I hadn't, and I cannot reproduce it locally.  Anyway, the
valgrind report is

==1617044== VALGRINDERROR-BEGIN
==1617044== Syscall param pwrite64(buf) points to uninitialised byte(s)
==1617044==    at 0x6704003: pwrite (pwrite64.c:25)
==1617044==    by 0x44AAC72: pg_pwritev (pg_iovec.h:101)
==1617044==    by 0x44AC6B5: FileWriteV (fd.c:2280)
==1617044==    by 0x44A8EC4: FileWrite (fd.h:245)
==1617044==    by 0x44A8EC4: BufFileDumpBuffer (buffile.c:538)
==1617044==    by 0x44A9034: BufFileFlush (buffile.c:724)
==1617044==    by 0x44A9661: BufFileClose (buffile.c:418)
==1617044==    by 0x426C4DE: export_initial_snapshot (repack_worker.c:346)
==1617044==    by 0x426CA17: RepackWorkerMain (repack_worker.c:145)
==1617044==    by 0x441D3AD: BackgroundWorkerMain (bgworker.c:865)
==1617044==    by 0x44219D9: postmaster_child_launch (launch_backend.c:265)
==1617044==  Address 0x12d745e2 is 106 bytes inside a block of size 8,272 client-defined
==1617044==    at 0x4661CFE: palloc (mcxt.c:1411)
==1617044==    by 0x44A8C54: makeBufFileCommon (buffile.c:121)
==1617044==    by 0x44A933F: BufFileCreateFileSet (buffile.c:272)
==1617044==    by 0x426C4A5: export_initial_snapshot (repack_worker.c:341)
==1617044==    by 0x426CA17: RepackWorkerMain (repack_worker.c:145)
==1617044==    by 0x441D3AD: BackgroundWorkerMain (bgworker.c:865)
==1617044==    by 0x44219D9: postmaster_child_launch (launch_backend.c:265)
==1617044==    by 0x4423B6D: StartBackgroundWorker (postmaster.c:4197)
==1617044==    by 0x4423DB8: maybe_start_bgworkers (postmaster.c:4362)
==1617044==    by 0x4425119: LaunchMissingBackgroundProcesses (postmaster.c:3437)
==1617044==    by 0x4426A75: ServerLoop (postmaster.c:1737)
==1617044==    by 0x44280DC: PostmasterMain (postmaster.c:1412)
==1617044==  Uninitialised value was created by a stack allocation
==1617044==    at 0x4674D39: SerializeSnapshot (snapmgr.c:1737)
==1617044== 
==1617044== VALGRINDERROR-END

and obviously BufFileCreateFileSet() is being called by existing code
already and it doesn't fail, so I *think* the problem might be that
SerializedSnapshotData has some padding bytes that are being written.
Maybe using palloc0() is enough?  I'll try that.

If that doesn't silence skink, I guess my next step is to reproduce
skink's environment more precisely ...

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"Uno puede defenderse de los ataques; contra los elogios se esta indefenso"



pgsql-hackers by date:

Previous
From: Haibo Yan
Date:
Subject: Re: Extract numeric filed in JSONB more effectively
Next
From: Srinath Reddy Sadipiralla
Date:
Subject: Re: Adding REPACK [concurrently]