Segment fault when excuting SPI function On PG with commit 41c6a5be

From: "liuhuailing(at)fujitsu(dot)com" <liuhuailing(at)fujitsu(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Segment fault when excuting SPI function On PG with commit 41c6a5be
Date: 2021-07-30 08:57:35
Message-ID: OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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.

Regards, Liu Huailing

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-07-30 09:21:50 Re: Slightly improve initdb --sync-only option's help message
Previous Message Aleksander Alekseev 2021-07-30 08:41:41 Re: Background writer and checkpointer in crash recovery