Re: Segment fault when excuting SPI function On PG with commit 41c6a5be - Mailing list pgsql-hackers

From Ranier Vilela
Subject Re: Segment fault when excuting SPI function On PG with commit 41c6a5be
Date
Msg-id CAEudQAq38W7uJpp04=fWKuGrUAYuM9j-JNSqj46Fbp1nnEzO0A@mail.gmail.com
Whole thread Raw
In response to Segment fault when excuting SPI function On PG with commit 41c6a5be  ("liuhuailing@fujitsu.com" <liuhuailing@fujitsu.com>)
List pgsql-hackers
Em sex., 30 de jul. de 2021 às 05:57, liuhuailing@fujitsu.com <liuhuailing@fujitsu.com> escreveu:
Hi, all

When I used SPI_execute_plan function on PG12 which commit 41c6a5be is used,
Segment fault occurred.

PS: If commit 41c6a5be is not used, this phenomenon will not happen.

Reproduce:
In a background process, the following steps are executed.
--------------------------
StartTransactionCommand();
SPI_connect();       
plan = SPI_prepare(query,0,NULL); ★the query is a SELECT SQL.
SPI_keepplan(plan);         
SPI_finish();           
CommitTransactionCommand();   
StartTransactionCommand();    
SPI_connect();
SPI_execute_plan(plan, NULL, NULL, true, 0); ★Segment fault
--------------------------

Core stack:
Stack trace of thread 43926:
                #0  0x0000000000772f19 EnsurePortalSnapshotExists (postgres)
                #1  0x000000000064f85c _SPI_execute_plan (postgres)
                #2  0x000000000064fbd1 SPI_execute_plan (postgres)
                #3  0x00007fbee784402e xxx (xxx.so)
                #4  0x00007fbee78424ae xxxx (xxxx.so)
                #5  0x00000000006e91f5 StartBackgroundWorker (postgres)
                #6  0x00000000006f5e25 maybe_start_bgworkers (postgres)
                #7  0x00000000006f6121 reaper (postgres)
                #8  0x00007fbeedf48dc0 __restore_rt (libpthread.so.0)
                #9  0x00007fbeebadf75b __select (libc.so.6)
                #10 0x00000000006f6ea6 ServerLoop (postgres)
                #11 0x00000000006f8c30 PostmasterMain (postgres)
                #12 0x0000000000485d99 main (postgres)
                #13 0x00007fbeeba0f873 __libc_start_main (libc.so.6)
                #14 0x0000000000485e3e _start (postgres)

Is there a bug in the commit 41c6a5be?  Please confirm it.
Did you test it on the HEAD too?

regards,
Ranier Vilela

pgsql-hackers by date:

Previous
From: Zhihong Yu
Date:
Subject: Re: Segment fault when excuting SPI function On PG with commit 41c6a5be
Next
From: Michael Paquier
Date:
Subject: Re: Segment fault when excuting SPI function On PG with commit 41c6a5be