crash_back_trace.txt

text/plain

Filename: crash_back_trace.txt
Type: text/plain
Part: 0
Message: [Bug] Usage of stale dead_items pointer in parallel vacuum
2025-10-01 20:12:07 IST::@:[458915]:LOG:  received fast shutdown request
2025-10-01 20:12:07 IST::@:[458915]:LOG:  aborting any active transactions
2025-10-01 20:12:07 IST::@:[458915]:LOG:  background worker "logical replication launcher" (PID 459153) exited with exit code 1
2025-10-01 20:12:07 IST::@:[459149]:LOG:  shutting down
2025-10-01 20:12:07 IST::@:[459149]:LOG:  checkpoint starting: shutdown immediate
2025-10-01 20:12:07 IST::@:[459149]:LOG:  checkpoint complete: wrote 0 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.001 s, sync=0.001 s, total=0.070 s; sync files=0, longest=0.000 s, average=0.000 s; distance=0 kB, estimate=266 kB; lsn=0/7FCA0F8, redo lsn=0/7FCA0F8
2025-10-01 20:12:07 IST::@:[458915]:LOG:  database system is shut down
2025-10-01 20:12:07 IST::@:[459314]:LOG:  starting PostgreSQL 17.6 on x86_64-pc-linux-gnu, compiled by clang version 19.1.5 (/home/runner/work/llvm-project/llvm-project/clang ab4b5a2db582958af1ee308a790cfdb42bd24720), 64-bit
2025-10-01 20:12:07 IST::@:[459314]:LOG:  listening on IPv4 address "127.0.0.1", port 5432
2025-10-01 20:12:07 IST::@:[459314]:LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2025-10-01 20:12:08 IST::@:[459318]:LOG:  database system was shut down at 2025-10-01 20:12:07 IST
2025-10-01 20:12:08 IST::@:[459314]:LOG:  database system is ready to accept connections
=================================================================
==459362==ERROR: AddressSanitizer: heap-use-after-free on address 0x507000022f88 at pc 0x639f45f3c8ac bp 0x7ffe014cef70 sp 0x7ffe014cef68
READ of size 8 at 0x507000022f88 thread T0
    #0 0x639f45f3c8ab in TidStoreSetBlockOffsets /home/kevin-23397/postgres_cstore/src/backend/access/common/tidstore.c:424:6
    #1 0x639f4607a22e in dead_items_add /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:2897:2
    #2 0x639f46075350 in lazy_scan_prune /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:1504:3
    #3 0x639f4607104d in lazy_scan_heap /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:977:15
    #4 0x639f4606ca36 in heap_vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:497:2
    #5 0x639f46630cc3 in table_relation_vacuum /home/kevin-23397/postgres_cstore/src/include/access/tableam.h:1711:2
    #6 0x639f4662bba8 in vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:2287:4
    #7 0x639f4662912a in vacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:633:10
    #8 0x639f46628283 in ExecVacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:452:2
    #9 0x639f46e70081 in standard_ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:859:4
    #10 0x639f46e6ee0e in ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:523:3
    #11 0x639f46e6dd37 in PortalRunUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1156:2
    #12 0x639f46e6bd5a in PortalRunMulti /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1313:5
    #13 0x639f46e6a3c9 in PortalRun /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:789:5
    #14 0x639f46e5fb2f in exec_simple_query /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:1278:10
    #15 0x639f46e5e47b in PostgresMain /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:4780:7
    #16 0x639f46e4eda1 in BackendMain /home/kevin-23397/postgres_cstore/src/backend/tcop/backend_startup.c:105:2
    #17 0x639f46bd78a4 in postmaster_child_launch /home/kevin-23397/postgres_cstore/src/backend/postmaster/launch_backend.c:277:3
    #18 0x639f46be2a6a in BackendStartup /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:3594:8
    #19 0x639f46bdf1b8 in ServerLoop /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1676:6
    #20 0x639f46bdda50 in PostmasterMain /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1374:11
    #21 0x639f468237ac in main /home/kevin-23397/postgres_cstore/src/backend/main/main.c:199:3
    #22 0x75d52842a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #23 0x75d52842a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #24 0x639f45dfdc94 in _start (/home/kevin-23397/pginstalls/pg17_6d_cstoretweaks/bin/postgres+0x3d6c94)

0x507000022f88 is located 72 bytes inside of 80-byte region [0x507000022f40,0x507000022f90)
freed by thread T0 here:
    #0 0x639f45e9cc96 in free /home/runner/work/llvm-project/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:52:3
    #1 0x639f47456fbb in free_chunk /home/kevin-23397/postgres_cstore/src/backend/utils/mmgr/malloccxt.c:51:2
    #2 0x639f474574b1 in MallocContextFree /home/kevin-23397/postgres_cstore/src/backend/utils/mmgr/malloccxt.c:120:2
    #3 0x639f4745d981 in pfree /home/kevin-23397/postgres_cstore/src/backend/utils/mmgr/mcxt.c:1539:2
    #4 0x639f45f3bcca in TidStoreDestroy /home/kevin-23397/postgres_cstore/src/backend/access/common/tidstore.c:342:2
    #5 0x639f4663306d in parallel_vacuum_reset_dead_items /home/kevin-23397/postgres_cstore/src/backend/commands/vacuumparallel.c:482:2
    #6 0x639f46076845 in dead_items_reset /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:2914:3
    #7 0x639f460739b8 in lazy_vacuum /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:1978:2
    #8 0x639f46070d57 in lazy_scan_heap /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:897:4
    #9 0x639f4606ca36 in heap_vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:497:2
    #10 0x639f46630cc3 in table_relation_vacuum /home/kevin-23397/postgres_cstore/src/include/access/tableam.h:1711:2
    #11 0x639f4662bba8 in vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:2287:4
    #12 0x639f4662912a in vacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:633:10
    #13 0x639f46628283 in ExecVacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:452:2
    #14 0x639f46e70081 in standard_ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:859:4
    #15 0x639f46e6ee0e in ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:523:3
    #16 0x639f46e6dd37 in PortalRunUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1156:2
    #17 0x639f46e6bd5a in PortalRunMulti /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1313:5
    #18 0x639f46e6a3c9 in PortalRun /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:789:5
    #19 0x639f46e5fb2f in exec_simple_query /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:1278:10
    #20 0x639f46e5e47b in PostgresMain /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:4780:7
    #21 0x639f46e4eda1 in BackendMain /home/kevin-23397/postgres_cstore/src/backend/tcop/backend_startup.c:105:2
    #22 0x639f46bd78a4 in postmaster_child_launch /home/kevin-23397/postgres_cstore/src/backend/postmaster/launch_backend.c:277:3
    #23 0x639f46be2a6a in BackendStartup /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:3594:8
    #24 0x639f46bdf1b8 in ServerLoop /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1676:6
    #25 0x639f46bdda50 in PostmasterMain /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1374:11
    #26 0x639f468237ac in main /home/kevin-23397/postgres_cstore/src/backend/main/main.c:199:3
    #27 0x75d52842a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #28 0x75d52842a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #29 0x639f45dfdc94 in _start (/home/kevin-23397/pginstalls/pg17_6d_cstoretweaks/bin/postgres+0x3d6c94)

previously allocated by thread T0 here:
    #0 0x639f45e9cf2f in malloc /home/runner/work/llvm-project/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:68:3
    #1 0x639f47457087 in MallocContextAlloc /home/kevin-23397/postgres_cstore/src/backend/utils/mmgr/malloccxt.c:96:26
    #2 0x639f4745d0cc in palloc0 /home/kevin-23397/postgres_cstore/src/backend/utils/mmgr/mcxt.c:1369:8
    #3 0x639f45f3ad21 in TidStoreCreateShared /home/kevin-23397/postgres_cstore/src/backend/access/common/tidstore.c:220:7
    #4 0x639f46632262 in parallel_vacuum_init /home/kevin-23397/postgres_cstore/src/backend/commands/vacuumparallel.c:379:15
    #5 0x639f46070413 in dead_items_alloc /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:2853:18
    #6 0x639f4606ca2a in heap_vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/access/heap/vacuumlazy.c:491:2
    #7 0x639f46630cc3 in table_relation_vacuum /home/kevin-23397/postgres_cstore/src/include/access/tableam.h:1711:2
    #8 0x639f4662bba8 in vacuum_rel /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:2287:4
    #9 0x639f4662912a in vacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:633:10
    #10 0x639f46628283 in ExecVacuum /home/kevin-23397/postgres_cstore/src/backend/commands/vacuum.c:452:2
    #11 0x639f46e70081 in standard_ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:859:4
    #12 0x639f46e6ee0e in ProcessUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/utility.c:523:3
    #13 0x639f46e6dd37 in PortalRunUtility /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1156:2
    #14 0x639f46e6bd5a in PortalRunMulti /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:1313:5
    #15 0x639f46e6a3c9 in PortalRun /home/kevin-23397/postgres_cstore/src/backend/tcop/pquery.c:789:5
    #16 0x639f46e5fb2f in exec_simple_query /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:1278:10
    #17 0x639f46e5e47b in PostgresMain /home/kevin-23397/postgres_cstore/src/backend/tcop/postgres.c:4780:7
    #18 0x639f46e4eda1 in BackendMain /home/kevin-23397/postgres_cstore/src/backend/tcop/backend_startup.c:105:2
    #19 0x639f46bd78a4 in postmaster_child_launch /home/kevin-23397/postgres_cstore/src/backend/postmaster/launch_backend.c:277:3
    #20 0x639f46be2a6a in BackendStartup /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:3594:8
    #21 0x639f46bdf1b8 in ServerLoop /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1676:6
    #22 0x639f46bdda50 in PostmasterMain /home/kevin-23397/postgres_cstore/src/backend/postmaster/postmaster.c:1374:11
    #23 0x639f468237ac in main /home/kevin-23397/postgres_cstore/src/backend/main/main.c:199:3
    #24 0x75d52842a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #25 0x75d52842a28a in __libc_start_main csu/../csu/libc-start.c:360:3
    #26 0x639f45dfdc94 in _start (/home/kevin-23397/pginstalls/pg17_6d_cstoretweaks/bin/postgres+0x3d6c94)

SUMMARY: AddressSanitizer: heap-use-after-free /home/kevin-23397/postgres_cstore/src/backend/access/common/tidstore.c:424:6 in TidStoreSetBlockOffsets
Shadow bytes around the buggy address:
  0x507000022d00: fa fa 00 00 00 00 00 00 00 00 00 00 fa fa fa fa
  0x507000022d80: 00 00 00 00 00 00 00 00 00 fa fa fa fa fa fd fd
  0x507000022e00: fd fd fd fd fd fd fd fa fa fa fa fa 00 00 00 00
  0x507000022e80: 00 00 00 00 04 fa fa fa fa fa 00 00 00 00 00 00
  0x507000022f00: 00 00 05 fa fa fa fa fa fd fd fd fd fd fd fd fd
=>0x507000022f80: fd[fd]fa fa fa fa fd fd fd fd fd fd fd fd fd fd
  0x507000023000: fa fa fa fa fd fd fd fd fd fd fd fd fd fa fa fa
  0x507000023080: fa fa fd fd fd fd fd fd fd fd fd fa fa fa fa fa
  0x507000023100: fd fd fd fd fd fd fd fd fd fa fa fa fa fa fd fd
  0x507000023180: fd fd fd fd fd fd fd fa fa fa fa fa fd fd fd fd
  0x507000023200: fd fd fd fd fd fa fa fa fa fa fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07 
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==459362==ABORTING
2025-10-01 20:12:13 IST::@:[459314]:LOG:  server process (PID 459362) exited with exit code 1
2025-10-01 20:12:13 IST::@:[459314]:DETAIL:  Failed process was running: VACUUM (PARALLEL 2) pvactst2;
2025-10-01 20:12:13 IST::@:[459314]:LOG:  terminating any other active server processes
2025-10-01 20:12:13 IST:[local]:kevin-23397@postgres:[459375]:FATAL:  the database system is in recovery mode
2025-10-01 20:12:13 IST::@:[459314]:LOG:  all server processes terminated; reinitializing
2025-10-01 20:12:13 IST::@:[459376]:LOG:  database system was interrupted; last known up at 2025-10-01 20:12:08 IST
2025-10-01 20:12:13 IST::@:[459376]:LOG:  database system was not properly shut down; automatic recovery in progress
2025-10-01 20:12:13 IST::@:[459376]:LOG:  redo starts at 0/7FCA170
2025-10-01 20:12:13 IST::@:[459376]:LOG:  unexpected pageaddr 0/2022000 in WAL segment 000000010000000000000008, LSN 0/8022000, offset 139264
2025-10-01 20:12:13 IST::@:[459376]:LOG:  redo done at 0/8021DA8 system usage: CPU: user: 0.01 s, system: 0.00 s, elapsed: 0.01 s
2025-10-01 20:12:13 IST::@:[459377]:LOG:  checkpoint starting: end-of-recovery immediate wait
2025-10-01 20:12:13 IST::@:[459377]:LOG:  checkpoint complete: wrote 35 buffers (0.2%); 0 WAL file(s) added, 1 removed, 0 recycled; write=0.037 s, sync=0.017 s, total=0.119 s; sync files=7, longest=0.009 s, average=0.003 s; distance=351 kB, estimate=351 kB; lsn=0/8022048, redo lsn=0/8022048
2025-10-01 20:12:13 IST::@:[459314]:LOG:  database system is ready to accept connections