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

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back
Дата
Msg-id 20220119014957.vfc4s74oy6rrdimu@alap3.anarazel.de
обсуждение исходный текст
Ответ на Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2022-01-18 17:12:00 -0500, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > Unfortunately, I can't reproduce this locally, even with COPT=-Wall
> > -Werror -fno-omit-frame-pointer -fsanitize-trap=alignment
> > -Wno-deprecated-declarations -DWRITE_READ_PARSE_PLAN_TREES
> > -DSTRESS_SORT_INT_MIN -DENFORCE_REGRESSION_TEST_NAME_RESTRICTIONS.
>
> Now that I re-read what you did, I believe you need both of
>
> -fsanitize=alignment -fsanitize-trap=alignment
>
> to enable those traps to happen.  That seems to be the case with
> Apple's clang, anyway.

FWIW, I can reproduce it on linux, but only if I -fno-sanitize-recover instead
of -fsanitize-trap=alignment. That then also produces a nicer explanation of
the problem:

/home/andres/src/postgresql/src/backend/replication/basebackup.c:1552:10: runtime error: member access within
misalignedaddress 0x000002b9ce09 for type 'PageHeaderData' (aka 'struct PageHeaderData'), which requires 4 byte
alignment
0x000002b9ce09: note: pointer points here
 00 00 00  64 00 00 00 00 c8 ad 0c  01 c5 1b 00 00 48 00 f0  1f f0 1f 04 20 00 00 00  00 62 31 05 00
              ^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior
/home/andres/src/postgresql/src/backend/replication/basebackup.c:1552:10in
 
2022-01-18 17:36:17.746 PST [1448756] LOG:  server process (PID 1448774) exited with exit code 1
2022-01-18 17:36:17.746 PST [1448756] DETAIL:  Failed process was running: BASE_BACKUP ( LABEL 'pg_basebackup base
backup', PROGRESS,  CHECKPOINT 'fast',  MANIFEST 'yes',  TARGET 'client')
 

The problem originates in bbsink_copystream_begin_backup()...

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: docs: pg_replication_origin_oid() description does not match behaviour
Следующее
От: Robert Haas
Дата:
Сообщение: Re: pgsql: Modify pg_basebackup to use a new COPY subprotocol for base back