Re: BUG #18354: Aborted transaction aborted during cleanup when temp_file_limit exceeded

From: Tender Wang <tndrwang(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: exclusion(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #18354: Aborted transaction aborted during cleanup when temp_file_limit exceeded
Date: 2024-02-22 03:49:29
Message-ID: CAHewXN=ZEL1Rvw2fJmt8k3sO_3fb58gijv7GR-JnY8ujgGP0UA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

When the first error was reported, we entered AbortTransaction(),
proc->xid was changed to InvalidTransactionId
in ProcArrayEndTransactionInternal().
After AbortTransaction() is done, we enter into CleanupTransaction(), and
error would be reported again. So we enter AbortTransaction() again because
the transaction block state is still TBLOCK_STARTED. MyProc->xid now is
InvalidTransactionId, so the assert failed.

Changing the behavior of tuplestore can work for this issue, but I'm not
sure if this change will affect other components which depend on
BufFile(like nodeMaterial)

Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> 于2024年2月22日周四 10:46写道:

> At Wed, 21 Feb 2024 12:00:01 +0000, PG Bug reporting form <
> noreply(at)postgresql(dot)org> wrote in
> > triggers two errors, a warning, and an assertion failure:
> > ERROR: temporary file size exceeds temp_file_limit (100kB)
> > WARNING: AbortTransaction while in ABORT state
> > ERROR: temporary file size exceeds temp_file_limit (100kB)
> > server closed the connection unexpectedly
> ...
> > For the second error:
> > 2024-02-21 11:40:07.001 UTC|law|regression|65d5e116.13cfcb|ERROR:
> temporary
> > file size exceeds temp_file_limit (100kB)
> > 2024-02-21 11:40:07.001 UTC|law|regression|65d5e116.13cfcb|BACKTRACE:
> > FileWrite at fd.c:2183:5
> > BufFileDumpBuffer at buffile.c:537:18
> > BufFileFlush at buffile.c:723:3
> > BufFileClose at buffile.c:419:9
> > tuplestore_end at tuplestore.c:459:5
> > MemoryContextSwitchTo at palloc.h:142:23
> > (inlined by) PortalDrop at portalmem.c:587:3
> > AtCleanup_Portals at portalmem.c:907:3
>
> Therefore, BufFileClose should not flush the content during error
> handling. In the first place, tuplestore doesn't need to flush the
> underlying files in _end and _clear. In this case, I would choose to
> change the general behavior of tuplestore. The attached PoC patch
> fixes the issue for me. It introduces a new "extended" function to
> control flushing, avoiding the addition of an unnatural parameter to
> BufFileClose. I suspect that it is usable in some other places, but I
> haven't checked that.
>
> regards.
>
> --
> Kyotaro Horiguchi
> NTT Open Source Software Center
>

--
Tender Wang
OpenPie: https://en.openpie.com/

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2024-02-22 03:56:31 BUG #18357: PGJDBC: how to pass the user defined type as input parameter to store procedure
Previous Message Kyotaro Horiguchi 2024-02-22 02:46:00 Re: BUG #18354: Aborted transaction aborted during cleanup when temp_file_limit exceeded