Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Date: 2022-01-18 22:06:11
Message-ID: 415090.1642543571@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

I wrote:
>> Tom, any chance you can get a stack trace?

> Hmm, I'd assumed that was just a cosmic ray or something.

My mistake: it's failing because of -fsanitize=alignment.

Here's the stack trace:

* frame #0: 0x000000010885dfd0 postgres`sendFile(sink=0x00007fdedf071cb0, readfilename="./global/4178", tarfilename="global/4178", statbuf=0x00007ffee77dfaf8, missing_ok=true, dboid=0, manifest=0x00007ffee77e2780, spcoid=0x0000000000000000) at basebackup.c:1552:10
frame #1: 0x000000010885cb7f postgres`sendDir(sink=0x00007fdedf071cb0, path="./global", basepathlen=1, sizeonly=false, tablespaces=0x00007fdedf072718, sendtblspclinks=true, manifest=0x00007ffee77e2780, spcoid=0x0000000000000000) at basebackup.c:1354:12
frame #2: 0x000000010885ca6b postgres`sendDir(sink=0x00007fdedf071cb0, path=".", basepathlen=1, sizeonly=false, tablespaces=0x00007fdedf072718, sendtblspclinks=true, manifest=0x00007ffee77e2780, spcoid=0x0000000000000000) at basebackup.c:1346:13
frame #3: 0x00000001088595be postgres`perform_base_backup(opt=0x00007ffee77e2e68, sink=0x00007fdedf071cb0) at basebackup.c:352:5
frame #4: 0x0000000108856b0b postgres`SendBaseBackup(cmd=0x00007fdedf05b510) at basebackup.c:932:3
frame #5: 0x00000001088711c8 postgres`exec_replication_command(cmd_string="BASE_BACKUP ( LABEL 'pg_basebackup base backup', PROGRESS, CHECKPOINT 'fast', MANIFEST 'yes', TARGET 'client')") at walsender.c:1734:4 [opt]
frame #6: 0x00000001088dd61e postgres`PostgresMain(dbname=<unavailable>, username=<unavailable>) at postgres.c:4494:12 [opt]

It failed at

-> 1552 if (!PageIsNew(page) && PageGetLSN(page) < sink->bbs_state->startptr)

and the problem is evidently that the page pointer isn't nicely aligned:

(lldb) p page
(char *) $4 = 0x00007fdeded7e041 ""

(I checked the "sink" data structure too for luck, but it seems fine.)

I see that thorntail has now also fallen over, presumably for
the same reason.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2022-01-18 22:12:00 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Previous Message Robert Haas 2022-01-18 21:58:18 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2022-01-18 22:12:00 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Previous Message Robert Haas 2022-01-18 21:58:18 Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back