From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | thomas(dot)d(dot)mckay(at)gmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #17607: Server process crashes when PLpgSQL function raises error in subtransaction |
Date: | 2022-09-25 19:01:15 |
Message-ID: | 3092360.1664132475@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | Postg토토 캔SQL : Postg토토 캔SQL 메일 링리스트 : 2022-09-25 이후 PGSQL-BUGS 19:01 |
I wrote:
> It seems to me there are probably other hazards here, because the tupdesc
> could possibly also go away before the slot does. I think what we ought
> to do is copy the tupdesc, so that we have a non-refcounted descriptor
> that we know has exactly the right lifespan. As attached.
Actually, after looking around some more, I realize that there is a
second mistake in 25936fd46: it ignored the comment on
AfterTriggerFreeQuery that
* Note: it's important for this to be safe if interrupted by an error
* and then called again for the same query level.
This is the reason why we end up in a recursive error and PANIC:
we keep trying to free the tupdesc again after the previous error.
If I fix that but omit the CreateTupleDescCopy step, then the
reproducer behaves much more sanely:
psql:bug17607.sql:29: WARNING: AbortSubTransaction while in ABORT state
psql:bug17607.sql:29: ERROR: BOOM !
CONTEXT: PL/pgSQL function on_tbl_parent_id_change_fn() line 3 at RAISE
ERROR: tupdesc reference 0x7fdef236a1b8 is not owned by resource owner SubTransaction
ROLLBACK
ROLLBACK
So what we actually need here is more like the attached.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
fix-trigger-tupdesc-refcount-issue-2.patch | text/x-diff | 1.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-09-25 20:34:05 | Re: BUG #17607: Server process crashes when PLpgSQL function raises error in subtransaction |
Previous Message | Tom Lane | 2022-09-25 18:24:07 | Re: BUG #17607: Server process crashes when PLpgSQL function raises error in subtransaction |