pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #17035: assert after commit
8+ messages / 4 participants
[nested] [flat]

Commits from this thread:
  2021-07-31 ef12f32c08 f260436459 cefb1230e7 93f99693f9 ec410c985e  Use elog, not Assert, to report failure to provide an outer snapshot.
* BUG #17035: assert after commit
@ 2021-05-26 06:55  PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 1 reply; 8+ messages in thread

From: PG Bug reporting form @ 2021-05-26 06:55 UTC (permalink / raw)
  To: pgsql-bugs@lists.postgresql.org; +Cc: rekgrpth@gmail.com

The following bug has been logged on the website:

Bug reference:      17035
Logged by:          RekGRpth
Email address:      rekgrpth@gmail.com
PostgreSQL version: 13.3
Operating system:   docker alpine
Description:        

after this commit

https://github.com/postgres/postgres/commit/d18ee6f92d9a22b4fae57f515797b2196bf385c7

I got assert

TRAP: FailedAssertion("portal != NULL", File: "pquery.c", Line: 1758)

in my plugin

https://github.com/RekGRpth/pg_task



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-26 13:52  Tom Lane <tgl@sss.pgh.pa.us>
  parent: PG Bug reporting form <noreply@postgresql.org>
  0 siblings, 2 replies; 8+ messages in thread

From: Tom Lane @ 2021-05-26 13:52 UTC (permalink / raw)
  To: rekgrpth@gmail.com; +Cc: pgsql-bugs@lists.postgresql.org

PG Bug reporting form <noreply@postgresql.org> writes:
> after this commit
> https://github.com/postgres/postgres/commit/d18ee6f92d9a22b4fae57f515797b2196bf385c7
> I got assert
> TRAP: FailedAssertion("portal != NULL", File: "pquery.c", Line: 1758)
> in my plugin
> https://github.com/RekGRpth/pg_task

I'm inclined to think that means you were doing something you
should not have been doing.  But without any details it's
hard to say.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-26 13:54  RekGRpth <rekgrpth@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 0 replies; 8+ messages in thread

From: RekGRpth @ 2021-05-26 13:54 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Ok, thanks. I only use SPI_execute_plan and before that commit all works fine
with bst regrds, Rek>pth

ср, 26 мая 2021 г. в 18:52, Tom Lane <tgl@sss.pgh.pa.us>:
>
> PG Bug reporting form <noreply@postgresql.org> writes:
> > after this commit
> > https://github.com/postgres/postgres/commit/d18ee6f92d9a22b4fae57f515797b2196bf385c7
> > I got assert
> > TRAP: FailedAssertion("portal != NULL", File: "pquery.c", Line: 1758)
> > in my plugin
> > https://github.com/RekGRpth/pg_task
>
> I'm inclined to think that means you were doing something you
> should not have been doing.  But without any details it's
> hard to say.
>
>                         regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-26 17:40  Alvaro Herrera <alvherre@alvh.no-ip.org>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 8+ messages in thread

From: Alvaro Herrera @ 2021-05-26 17:40 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

On 2021-May-26, Tom Lane wrote:

> PG Bug reporting form <noreply@postgresql.org> writes:
> > after this commit
> > https://github.com/postgres/postgres/commit/d18ee6f92d9a22b4fae57f515797b2196bf385c7
> > I got assert
> > TRAP: FailedAssertion("portal != NULL", File: "pquery.c", Line: 1758)
> > in my plugin
> > https://github.com/RekGRpth/pg_task
> 
> I'm inclined to think that means you were doing something you
> should not have been doing.  But without any details it's
> hard to say.

Hmm, see for example [1] which is doing SPI_prepare_my() [2] and then
SPI_execute_plan_my() ... Does the SPI interface really require that you
create an ActivePortal in the SPI-calling code?  This looks a bit
suspicious to me ...

[1] https://github.com/RekGRpth/pg_task/blob/master/work.c#L703
[2] https://github.com/RekGRpth/pg_task/blob/master/spi.c

-- 
Álvaro Herrera       Valdivia, Chile





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-26 17:47  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2021-05-26 17:47 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: rekgrpth@gmail.com; pgsql-bugs@lists.postgresql.org

Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> Hmm, see for example [1] which is doing SPI_prepare_my() [2] and then
> SPI_execute_plan_my() ... Does the SPI interface really require that you
> create an ActivePortal in the SPI-calling code?

The expectation is that the calling code is already executing inside
some Portal.  If it isn't, it's incumbent on the caller to set up
an adequate substitute environment, in particular a transaction
snapshot.  The only thing 84f5c2908 changed is that now you get
a guaranteed failure if you neglect to provide that, rather than
failing only in corner cases.

Possibly we should change that Assert to an elog that tries to
make it clear that the blame is on the caller.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-27 03:00  RekGRpth <rekgrpth@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 8+ messages in thread

From: RekGRpth @ 2021-05-27 03:00 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Ok, I see. But I use SPI_execute_plan in background worker and no
ActivePortal there
with bst regrds, Rek>pth

ср, 26 мая 2021 г. в 22:47, Tom Lane <tgl@sss.pgh.pa.us>:
>
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > Hmm, see for example [1] which is doing SPI_prepare_my() [2] and then
> > SPI_execute_plan_my() ... Does the SPI interface really require that you
> > create an ActivePortal in the SPI-calling code?
>
> The expectation is that the calling code is already executing inside
> some Portal.  If it isn't, it's incumbent on the caller to set up
> an adequate substitute environment, in particular a transaction
> snapshot.  The only thing 84f5c2908 changed is that now you get
> a guaranteed failure if you neglect to provide that, rather than
> failing only in corner cases.
>
> Possibly we should change that Assert to an elog that tries to
> make it clear that the blame is on the caller.
>
>                         regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-27 03:22  Tom Lane <tgl@sss.pgh.pa.us>
  parent: RekGRpth <rekgrpth@gmail.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Tom Lane @ 2021-05-27 03:22 UTC (permalink / raw)
  To: RekGRpth <rekgrpth@gmail.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

RekGRpth <rekgrpth@gmail.com> writes:
> Ok, I see. But I use SPI_execute_plan in background worker and no
> ActivePortal there

Well, you need to provide a snapshot.  replication/worker.c
might serve as an example.

			regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: BUG #17035: assert after commit
@ 2021-05-27 03:51  RekGRpth <rekgrpth@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 8+ messages in thread

From: RekGRpth @ 2021-05-27 03:51 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>

Ok, thanks. I add PushActiveSnapshot(GetTransactionSnapshot()); after
SPI_start_transaction and PopActiveSnapshot(); before SPI_commit and
it works!
with bst regrds, Rek>pth

чт, 27 мая 2021 г. в 08:22, Tom Lane <tgl@sss.pgh.pa.us>:
>
> RekGRpth <rekgrpth@gmail.com> writes:
> > Ok, I see. But I use SPI_execute_plan in background worker and no
> > ActivePortal there
>
> Well, you need to provide a snapshot.  replication/worker.c
> might serve as an example.
>
>                         regards, tom lane





^ permalink  raw  reply  [nested|flat] 8+ messages in thread


end of thread, other threads:[~2021-05-27 03:51 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-05-26 06:55 BUG #17035: assert after commit PG Bug reporting form <noreply@postgresql.org>
2021-05-26 13:52 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-05-26 13:54   ` RekGRpth <rekgrpth@gmail.com>
2021-05-26 17:40   ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2021-05-26 17:47     ` Tom Lane <tgl@sss.pgh.pa.us>
2021-05-27 03:00       ` RekGRpth <rekgrpth@gmail.com>
2021-05-27 03:22         ` Tom Lane <tgl@sss.pgh.pa.us>
2021-05-27 03:51           ` RekGRpth <rekgrpth@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox