Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 24 Nov 2024 15:46:35 +0000
From:      bugzilla-noreply@freebsd.org
To:        ports-bugs@FreeBSD.org
Subject:   [Bug 282948] databases/postgresql-ogr_fdw: postgresql17 server core dump on create materialized view of foreign table
Message-ID:  <bug-282948-7788@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D282948

            Bug ID: 282948
           Summary: databases/postgresql-ogr_fdw: postgresql17 server core
                    dump on create materialized view of foreign table
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: lbartoletti@FreeBSD.org
          Reporter: d8zNeCFG@aon.at
             Flags: maintainer-feedback?(lbartoletti@FreeBSD.org)
          Assignee: lbartoletti@FreeBSD.org

Scenario:
- FreeBSD stable/14 4e8444d5750a with minor local patches
- ports latest
- Installed databases/postgresql17-server, databases/postgis35, and
databases/postgresql-ogr_fdw
- Executing the following SQL commands via psql (database superuser only wh=
ere
necessary, otherwise as the normal user "martin"):

# create extension postgis;
# create extension ogr_fdw;
# CREATE SERVER rijkswaterstaat
    FOREIGN DATA WRAPPER ogr_fdw
    OPTIONS (=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20
      datasource
'WFS:https://geo.rijkswaterstaat.nl/services/ogc/gdr/nwb_wegen/ows?service=
=3DWFS&request=3Dgetcapabilities&version=3D2.0.0',
      format 'WFS');
# grant usage on foreign server rijkswaterstaat to martin;

- change to normal user

> select version();
                                        version=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
---------------------------------------------------------------------------=
-------------
 PostgreSQL 17.2 on amd64-portbld-freebsd14.2, compiled by clang version
15.0.7, 64-bit
(1 row)

> select postgis_version();
            postgis_version=20=20=20=20=20=20=20=20=20=20=20=20
---------------------------------------
 3.5 USE_GEOS=3D1 USE_PROJ=3D1 USE_STATS=3D1
(1 row)

> select ogr_fdw_version();
       ogr_fdw_version=20=20=20=20=20=20=20
-----------------------------
 OGR_FDW=3D"1.1" GDAL=3D"3.10.0"
(1 row)

martin=3D>=20
> create schema rijkswaterstaat;
> set search_path to "$user", public, rijkswaterstaat;
> import foreign schema ogr_all from server rijkswaterstaat into rijkswater=
staat;
> \d
                              List of relations
     Schema      |              Name              |     Type      |  Owner=
=20=20=20
-----------------+--------------------------------+---------------+--------=
--
 public          | geography_columns              | view          | postgres
 public          | geometry_columns               | view          | postgres
 public          | spatial_ref_sys                | table         | postgres
 rijkswaterstaat | nwb_wegen_hectopunten          | foreign table | martin
 rijkswaterstaat | nwb_wegen_mutaties_hectopunten | foreign table | martin
 rijkswaterstaat | nwb_wegen_mutaties_wegvakken   | foreign table | martin
 rijkswaterstaat | nwb_wegen_nwb_light            | foreign table | martin
 rijkswaterstaat | nwb_wegen_wegvakken            | foreign table | martin
(8 rows)

> create materialized view public.nwb_wegen_wegvakken_mat as select * from =
rijkswaterstaat.nwb_wegen_wegvakken;
server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.
The connection to the server was lost. Attempting reset: Failed.
!?>=20

Result:
- At this point the postgresql process serving the request dumps core
- Running gdb:

[0]# gdb /usr/local/bin/postgres postgres.core
GNU gdb (GDB) 15.1 [GDB v15.1 for FreeBSD]
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=
l>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-portbld-freebsd14.2".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /usr/local/bin/postgres...
(No debugging symbols found in /usr/local/bin/postgres)
[New LWP 100757]
Core was generated by `postgres: martin martin 192.168.1.19(42834) CREATE
MATERIALIZED VIEW'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0  0x000000083053bdab in ?? () from /usr/local/lib/postgresql/ogr_fdw.so
(gdb) where
#0  0x000000083053bdab in ?? () from /usr/local/lib/postgresql/ogr_fdw.so
#1  0x00000008305384af in ?? () from /usr/local/lib/postgresql/ogr_fdw.so
#2  0x0000000000791e64 in ExecInitForeignScan ()
#3  0x000000000077ebef in ExecInitNode ()
#4  0x0000000000778003 in standard_ExecutorStart ()
#5  0x0000000000716634 in RefreshMatViewByOid ()
#6  0x00000000006ef961 in ExecCreateTableAs ()
#7  0x000000000094e5f7 in ?? ()
#8  0x000000000094d0c8 in standard_ProcessUtility ()
#9  0x000000000094c9f1 in ProcessUtility ()
#10 0x000000000094c5ff in ?? ()
#11 0x000000000094bddc in ?? ()
#12 0x000000000094b87f in PortalRun ()
#13 0x000000000094a899 in ?? ()
#14 0x00000000009483e9 in PostgresMain ()
#15 0x0000000000943c02 in BackendMain ()
#16 0x00000000008a7ad6 in postmaster_child_launch ()
#17 0x00000000008abcd6 in ?? ()
#18 0x00000000008a959a in PostmasterMain ()
#19 0x00000000007ce9f8 in main ()
(gdb)=20

- The postgres log contains the following:

[0]# tail -20 /var/log/postgres.log
... (some older lines omitted)
Nov 24 16:30:50 hal postgres[1085]: [7-1] 2024-11-24 16:30:50.390 CET [1085]
LOG:  server process (PID 26818) was terminated by signal 11: Segmentation
fault
Nov 24 16:30:50 hal postgres[1085]: [7-2] 2024-11-24 16:30:50.390 CET [1085]
DETAIL:  Failed process was running: create materialized view
public.nwb_wegen_wegvakken_mat as select * from
rijkswaterstaat.nwb_wegen_wegvakken;
Nov 24 16:30:50 hal postgres[1085]: [8-1] 2024-11-24 16:30:50.390 CET [1085]
LOG:  terminating any other active server processes
Nov 24 16:30:50 hal postgres[1085]: [9-1] 2024-11-24 16:30:50.392 CET [1085]
LOG:  all server processes terminated; reinitializing
Nov 24 16:30:50 hal postgres[26820]: [10-1] 2024-11-24 16:30:50.447 CET [26=
820]
LOG:  database system was interrupted; last known up at 2024-11-24 16:24:08=
 CET
Nov 24 16:30:50 hal postgres[26820]: [11-1] 2024-11-24 16:30:50.703 CET [26=
820]
LOG:  database system was not properly shut down; automatic recovery in
progress
Nov 24 16:30:50 hal postgres[26820]: [12-1] 2024-11-24 16:30:50.747 CET [26=
820]
LOG:  redo starts at 0/8E872518
Nov 24 16:30:55 hal postgres[26820]: [13-1] 2024-11-24 16:30:55.322 CET [26=
820]
LOG:  invalid magic number 0000 in WAL segment 00000001000000000000009C, LSN
0/9C430000, offset 4390912
Nov 24 16:30:55 hal postgres[26820]: [14-1] 2024-11-24 16:30:55.322 CET [26=
820]
LOG:  redo done at 0/9C42FF80 system usage: CPU: user: 1.82 s, system: 2.71=
 s,
elapsed: 4.59 s
Nov 24 16:30:55 hal postgres[26821]: [10-1] 2024-11-24 16:30:55.456 CET [26=
821]
LOG:  checkpoint starting: end-of-recovery immediate wait
Nov 24 16:30:55 hal postgres[26821]: [11-1] 2024-11-24 16:30:55.913 CET [26=
821]
LOG:  checkpoint complete: wrote 63 buffers (0.4%); 0 WAL file(s) added, 11
removed, 3 recycled; write=3D0.006 s, sync=3D0.301 s, total=3D0.466 s; sync=
 files=3D39,
longest=3D0.009 s, average=3D0.008 s; distance=3D225014 kB, estimate=3D2250=
14 kB;
lsn=3D0/9C430048, redo lsn=3D0/9C430048
Nov 24 16:30:55 hal postgres[1085]: [10-1] 2024-11-24 16:30:55.927 CET [108=
5]
LOG:  database system is ready to accept connections
[0]#=20

- A very few times the "create materialized view" succeeded, but the "shape"
column in this view would be empty.

Expected result:
- The "create materialized view" should succeed.

Note:
- In a setup on Windows 11 using PostgreSQL 16 (installed via EnterpriseDB),
the operation works flawlessly. The following versions are installed:

[0]% psql -h localhost world martin
psql (16.2)
Type "help" for help.

> select version();
                          version
------------------------------------------------------------
 PostgreSQL 16.2, compiled by Visual C++ build 1937, 64-bit
(1 row)

> select postgis_version();
            postgis_version
---------------------------------------
 3.4 USE_GEOS=3D1 USE_PROJ=3D1 USE_STATS=3D1
(1 row)

> select ogr_fdw_version();
      ogr_fdw_version
----------------------------
 OGR_FDW=3D"1.1" GDAL=3D"3.7.1"
(1 row)

world=3D>
\q
[0]%

-- Martin

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-282948-7788>