Assertion failure when autovacuum drops orphan temp indexes. - Mailing list pgsql-hackers

From Masahiko Sawada
Subject Assertion failure when autovacuum drops orphan temp indexes.
Date
Msg-id CAD21AoBgF9etQrXbN9or_YHsmBRJHHNUEkhHp9rGK9CyQv5aTQ@mail.gmail.com
Whole thread Raw
List pgsql-hackers
Hi,

I got the following assertion failure from an autovaucum worker:

2024-10-26 00:32:03.685 PDT [830672] LOG:  autovacuum: dropping orphan
temp table "postgres.pg_temp_0.hoge"
TRAP: failed Assert("HaveRegisteredOrActiveSnapshot()"), File:
"index.c", Line: 2345, PID: 830672

Here is the stack trace I got:

(lldb) bt
* thread #1, name = 'postgres', stop reason = signal SIGABRT
  * frame #0: 0x00007f8ab215952f libc.so.6`raise + 271
    frame #1: 0x00007f8ab212ce65 libc.so.6`abort + 295
    frame #2: 0x0000000000bd636e
postgres`ExceptionalCondition(conditionName="", fileName="",
lineNumber=2345) at assert.c:66:2
    frame #3: 0x00000000005de1fb postgres`index_drop(indexId=16389,
concurrent=false, concurrent_lock_mode=false) at index.c:2345:3
    frame #4: 0x00000000005d0d7d
postgres`doDeletion(object=0x0000000002a96ab0, flags=21) at
dependency.c:1367:6
    frame #5: 0x00000000005d088c
postgres`deleteOneObject(object=0x0000000002a96ab0,
depRel=0x00007ffe04079260, flags=21) at dependency.c:1274:2
    frame #6: 0x00000000005cf243
postgres`deleteObjectsInList(targetObjects=0x0000000002a9cf48,
depRel=0x00007ffe04079260, flags=21) at dependency.c:229:3
    frame #7: 0x00000000005cf2f8
postgres`performDeletion(object=0x00007ffe04079374,
behavior=DROP_CASCADE, flags=21) at dependency.c:314:2
    frame #8: 0x000000000092302e postgres`do_autovacuum at autovacuum.c:2215:3
    frame #9: 0x00000000009220ee
postgres`AutoVacWorkerMain(startup_data=0x0000000000000000,
startup_data_len=0) at autovacuum.c:1571:3
    frame #10: 0x0000000000928742
postgres`postmaster_child_launch(child_type=B_AUTOVAC_WORKER,
startup_data=0x0000000000000000, startup_data_len=0,
client_sock=0x0000000000000000)at launch_backend.c:274:3
    frame #11: 0x000000000092e0c9
postgres`StartChildProcess(type=B_AUTOVAC_WORKER) at
postmaster.c:3736:8
    frame #12: 0x000000000092e1a7 postgres`StartAutovacuumWorker at
postmaster.c:3790:14
    frame #13: 0x000000000092df72 postgres`process_pm_pmsignal at
postmaster.c:3628:3
    frame #14: 0x000000000092b5b8 postgres`ServerLoop at postmaster.c:1646:5
    frame #15: 0x000000000092afed postgres`PostmasterMain(argc=5,
argv=0x00000000029c83e0) at postmaster.c:1351:11
    frame #16: 0x00000000007eaa4d postgres`main(argc=5,
argv=0x00000000029c83e0) at main.c:197:3
    frame #17: 0x00007f8ab21457e5 libc.so.6`__libc_start_main + 229
    frame #18: 0x00000000004a44be postgres`_start + 46

The reproducible steps are:

1. execute "create temp table test (a int primary key)" and keep the
psql session open.
2. shutdown the server in immediate mode.
3. restart the server.
4. when cleaning up the orphan temp table, autovacuum worker raises
the assertion failure.

This assertion was recently introduced in commit b52adbad467. cc-ed
Nathan as committer of the related commit.

Regards,

-- 
Masahiko Sawada
Amazon Web Services: https://aws.amazon.com



pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: Can rs_cindex be < 0 for bitmap heap scans?
Next
From: "Andrey M. Borodin"
Date:
Subject: Re: [PATCH] Add sortsupport for range types and btree_gist