Assertion failure when autovacuum drops orphan temp indexes.

From: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Subject: Assertion failure when autovacuum drops orphan temp indexes.
Date: 2024-10-26 07:43:44
Message-ID: CAD21AoBgF9etQrXbN9or_YHsmBRJHHNUEkhHp9rGK9CyQv5aTQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey M. Borodin 2024-10-26 08:40:15 Re: [PATCH] Add sortsupport for range types and btree_gist
Previous Message Pavel Stehule 2024-10-26 07:20:12 Re: proposal: plpgsql, new check for extra_errors - strict_expr_check