Re: BUG #18133: Canceling statement due to statement timeout

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: SOzcn <selahattinozcnma(at)gmail(dot)com>
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18133: Canceling statement due to statement timeout
Date: 2023-09-25 15:49:54
Message-ID: CAKAnmmJouS1-LLfN5T2+htF9E1WMkwGCQTBYxi0Sd=uAOCx8zQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

> ERROR: canceling statement due to statement timeout
> STATEMENT: DROP INDEX dbname."idname"

The problem is likely that you have a prepared transaction, as shown in
your startup log:

> 2023-09-25 12:56:27.408 +03 [16513] LOG: recovering
> prepared transaction 101134325 from shared memory

This transaction will persist across restarts, and can prevent things like
a DROP INDEX from being able to complete, hence your eventual timeout.

If you are not actively using prepared transactions, it is highly
recommended that you set your max_prepared_transactions setting to 0 in
your postgresql.conf file.

To see which transactions you have currently prepared, run:

SELECT * FROM pg_prepared_xacts;

You should see an entry in that view with a transaction of 101134325

At this point, you will need to commit or rollback that transaction. If you
don't recognize it or know what it does, I would roll it back:

ROLLBACK PREPARED 'foobar';

Replace the word foobar with whatever value is in the 'gid' column of
pg_prepared_xacts

Once that is done, I suspect your DROP INDEX will proceed without a problem.

More information on prepared transactions:

https://www.postgresql.org/docs/current/sql-prepare-transaction.html

Cheers,
Greg

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andres Freund 2023-09-25 17:45:04 Re: BUG #18124: PG16 release note document bug in "Add build option to allow testing of small WAL segment sizes"
Previous Message SOzcn 2023-09-25 10:31:39 Re: BUG #18133: Canceling statement due to statement timeout