supabase / supautils

PostgreSQL extension that secures a cluster on a cloud environment

Home Page:https://supabase.github.io/supautils

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`show all` causes a segfault

darora opened this issue · comments

Running a show all statement causes a postgres segfault when supautils is in use. This statement seems to be used by Postico 2 at initial connection time.

2022-04-14 06:13:00.898 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,31,"startup",2022-04-14 06:13:00 UTC,5/1,0,DEBUG,00000,"CommitTransaction(1) name: unnamed; blockState: STARTED; state: INPROGRESS, xid/subid/cid: 0/1/0",,,,,,,,,"psql","client backend",,0                                
2022-04-14 06:13:00.898 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,32,"startup",2022-04-14 06:13:00 UTC,5/0,0,DEBUG,00000,"find_in_dynamic_libpath: trying ""/usr/lib/postgresql/lib/supautils""",,,,,,,,,"psql","client backend",,0
2022-04-14 06:13:00.898 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,33,"startup",2022-04-14 06:13:00 UTC,5/0,0,DEBUG,00000,"find_in_dynamic_libpath: trying ""/usr/lib/postgresql/lib/supautils.so""",,,,,,,,,"psql","client backend",,0
2022-04-14 06:13:00.899 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,34,"startup",2022-04-14 06:13:00 UTC,5/0,0,DEBUG,00000,"loaded library ""supautils""",,,,,,,,,"psql","client backend",,0
2022-04-14 06:13:00.900 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,35,"idle",2022-04-14 06:13:00 UTC,5/2,0,DEBUG,00000,"StartTransaction(1) name: unnamed; blockState: DEFAULT; state: INPROGRESS, xid/subid/cid: 0/1/0",,,,,,,,,"psql","client backend",,0
2022-04-14 06:13:00.900 UTC,"supabase_admin","postgres",138100,"127.0.0.1:51074",6257bb6c.21b74,36,"idle",2022-04-14 06:13:00 UTC,5/2,0,LOG,00000,"statement: show all;",,,,,,,,,"psql","client backend",,0
2022-04-14 06:13:01.103 UTC,,,138085,,6257bb65.21b65,13,,2022-04-14 06:12:53 UTC,,0,DEBUG,00000,"reaping dead processes",,,,,,,,,"","postmaster",,0                                                                                                                                                                         
2022-04-14 06:13:01.103 UTC,,,138085,,6257bb65.21b65,14,,2022-04-14 06:12:53 UTC,,0,DEBUG,00000,"server process (PID 138100) was terminated by signal 11: Segmentation fault","Failed process was running: show all;",,,,,,,,"","postmaster",,0                                                                             
2022-04-14 06:13:01.103 UTC,,,138085,,6257bb65.21b65,15,,2022-04-14 06:12:53 UTC,,0,LOG,00000,"server process (PID 138100) was terminated by signal 11: Segmentation fault","Failed process was running: show all;",,,,,,,,"","postmaster",,0

I suspect this was introduced in abc47d6

Reproduced:

supautils-with-pg-13 psql

> show all

The connection to the server was lost. Attempting reset: 2022-04-14 08:53:08.280 -05 [63034] LOG:  server process (PID 63047) was terminated by signal 11: Segmentation fault
2022-04-14 08:53:08.280 -05 [63034] DETAIL:  Failed process was running: show all;
2022-04-14 08:53:08.280 -05 [63034] LOG:  terminating any other active server processes
2022-04-14 08:53:08.280 -05 [63039] WARNING:  terminating connection because of crash of another server process
2022-04-14 08:53:08.280 -05 [63039] DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally an
d possibly corrupted shared memory.
2022-04-14 08:53:08.280 -05 [63039] HINT:  In a moment you should be able to reconnect to the database and repeat your command.
2022-04-14 08:53:08.280 -05 [63050] FATAL:  the database system is in recovery mode
Failed.
!?> 2022-04-14 08:53:08.280 -05 [63034] LOG:  all server processes terminated; reinitializing
2022-04-14 08:53:08.286 -05 [63051] LOG:  database system was interrupted; last known up at 2022-04-14 08:53:06 -05
2022-04-14 08:53:08.286 -05 [63051] LOG:  database system was not properly shut down; automatic recovery in progress
2022-04-14 08:53:08.287 -05 [63051] LOG:  redo starts at 0/16475C0
2022-04-14 08:53:08.287 -05 [63051] LOG:  invalid record length at 0/1663818: wanted 24, got 0
2022-04-14 08:53:08.287 -05 [63051] LOG:  redo done at 0/16636D0
2022-04-14 08:53:08.289 -05 [63034] LOG:  database system is ready to accept connections

This happens because the ShowAllGUCConfig function(the one that does SHOW ALL) expects a non-null description here.