Skip to content

Overriding idle_in_transaction_session_timeout doesn't seem to work properly #366

@franciscoreinolds

Description

@franciscoreinolds

Possibly related to #222

Today, I was trying to repack a table and I got the following warning: ERROR: query failed: FATAL: terminating connection due to idle-in-transaction timeout.

As I had an idle_in_transaction_session_timeout of "just" 2h, I thought I'd retry (since it could very well have been 2h since it had begun), this time setting it to 0, and the same behaviour was observed:

Details

$ sudo -u postgres PGOPTIONS="-c idle_in_transaction_session_timeout=0" PGOPTIONS="-c statement_timeout=0" pg_repack --no-kill-backend --wait-timeout=180 --table=<table> <database>
INFO: repacking table "public.<table>"
ERROR: query failed: FATAL:  terminating connection due to idle-in-transaction timeout
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
DETAIL: query was: SAVEPOINT repack_sp1

To check that it does indeed work, I tried running it again, but setting it to 5s so that it's obvious if PGOPTIONS is actually overriding the timeouts or not, and it worked as expected:

Details

$ time sudo -u postgres PGOPTIONS="-c idle_in_transaction_session_timeout=5s" PGOPTIONS="-c statement_timeout=5s" pg_repack --no-kill-backend --wait-timeout=180 --table=<table> <database>
INFO: repacking table "public.<table>"
ERROR: query failed: ERROR:  canceling statement due to statement timeout
DETAIL: query was: INSERT INTO repack.table_16480 SELECT <...> FROM ONLY public.<table>

real    0m5.169s
user    0m0.024s
sys     0m0.008s

So this seems to indicate that there's some kind of problem with the timeouts.

Looking forward to hear your perspective on this,

Francisco

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions