Re: [PATCH] plpython function causes server panic

From: Hao Zhang <zhrt1446384557(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH] plpython function causes server panic
Date: 2023-12-04 09:21:29
Message-ID: CALY6Dr8fPasw5DP3FFD2YjRZMKeX9_Ank14tz_bmPjjqLB1U7g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks for your reply. These patches look good to me!

> The only readily-reachable error case in BeginInternalSubTransaction
> is this specific one about IsInParallelMode, which was added later
> than the original design and evidently with not a lot of thought or
> testing. The comment for it speculates about whether we could get
> rid of it, so I wonder if our thoughts about this ought to go in that
> direction.

IMHO, there are other error reports in the function
BeginInternalSubTransaction(), like
```
ereport(ERROR,
(errcode(ERRCODE_OUT_OF_MEMORY),
errmsg("out of memory"),
errdetail("Failed on request of size %zu in memory context
\"%s\".",
size, context->name)));
```
we cannot avoid this crash by just getting rid of IsInParallelMode().

And in my test, the server won't crash in the plperl test.

With regards,
Hao Zhang

Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 于2023年12月2日周六 09:51写道:

> I wrote:
> > The only readily-reachable error case in BeginInternalSubTransaction
> > is this specific one about IsInParallelMode, which was added later
> > than the original design and evidently with not a lot of thought or
> > testing. The comment for it speculates about whether we could get
> > rid of it, so I wonder if our thoughts about this ought to go in that
> > direction.
>
> After thinking a bit more I wonder why we need that error check at all.
> Why isn't it sufficient to rely on GetNewTransactionId()'s check that
> throws an error if a parallelized subtransaction tries to obtain an XID?
> I don't see why we'd need to "synchronize transaction state" about
> anything that never acquires an XID.
>
> regards, tom lane
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message zhihuifan1213 2023-12-04 09:31:39 Re: Avoid detoast overhead when possible
Previous Message John Naylor 2023-12-04 09:10:36 Re: Add pg_basetype() function to obtain a DOMAIN base type