Postgres segfaults on raster query
Regina Obe
lr at pcorp.us
Thu Jan 18 21:06:09 PST 2024
> This seems… odd to me? In what context is putting postgis into the preload a
> requirement?
>
> P
>
> > On Jan 18, 2024, at 8:20 PM, Scott <public at postholer.com> wrote:
> >
> > Bam!
> >
> > That was it. Thanks Regina, you rock!
> >
> > On 1/18/24 20:16, Regina Obe wrote:
> >> ALTER SYSTEM SET shared_preload_libraries = 'postgis-3';
The only time I've seen it be a requirement is with mobilitydb, where they are relying on the postgis-3 library to be already loaded and are dynamically linking to it.
I recall I used to see reference to the postgis-3 when I'd do
ldd /usr/lib/postgresql/16/lib/libMobilityDB-1.1.so
When it's not preloaded, mobilitydb crashes in a similar fashion which is why I thought about this.
Though I'm not seeing reference to that anymore though (or maybe I only saw is on windows), but it still relies on postgis-3 to load.
So when Scott said it works if he runs postgis_full_version() before hand, got me thinking, it must be relying on postgis already loaded and postgis_full_version() loads postgis lib first.
But for postgis_raster that should not be required, since postgis_raster has the liblwgeom baked into it so it never links directly to postgis-3 or at least shouldn't be.
@Scott,
Can you run an ldd check on your postgis_raster-3?
If you don't know where it is
pg_config | grep PKGLIBDIR
Should tell you the folder
Mine looks like below -- verify you don't have reference to postgis-3.so
ldd /usr/lib/postgresql/16/lib/postgis_raster-3.so
linux-vdso.so.1 (0x00007ffd7efda000)
libgdal.so.34 => /lib/x86_64-linux-gnu/libgdal.so.34 (0x00007f73f3b59000)
libgeos_c.so.1 => /usr/local/lib/libgeos_c.so.1 (0x00007f73f3b0c000)
libproj.so.25 => /lib/x86_64-linux-gnu/libproj.so.25 (0x00007f73f370b000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f73f362c000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73f344a000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f73f342b000)
libcurl-gnutls.so.4 => /lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f73f336e000)
libodbc.so.2 => /lib/x86_64-linux-gnu/libodbc.so.2 (0x00007f73f32fd000)
libodbcinst.so.2 => /lib/x86_64-linux-gnu/libodbcinst.so.2 (0x00007f73f32e5000)
libxml2.so.2 => /lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f73f3133000)
libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f73f2cac000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f73f2c7c000)
libdeflate.so.0 => /lib/x86_64-linux-gnu/libdeflate.so.0 (0x00007f73f2c66000)
liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007f73f2c40000)
libblosc.so.1 => /lib/x86_64-linux-gnu/libblosc.so.1 (0x00007f73f2c30000)
libarmadillo.so.12 => /lib/libarmadillo.so.12 (0x00007f73f2c1e000)
libqhull_r.so.8.0 => /lib/x86_64-linux-gnu/libqhull_r.so.8.0 (0x00007f73f2ba8000)
libxerces-c-3.2.so => /lib/x86_64-linux-gnu/libxerces-c-3.2.so (0x00007f73f280d000)
libjpeg.so.62 => /lib/x86_64-linux-gnu/libjpeg.so.62 (0x00007f73f2778000)
libtiff.so.6 => /lib/x86_64-linux-gnu/libtiff.so.6 (0x00007f73f26eb000)
libgeotiff.so.5 => /lib/x86_64-linux-gnu/libgeotiff.so.5 (0x00007f73f26b5000)
libheif.so.1 => /lib/x86_64-linux-gnu/libheif.so.1 (0x00007f73f25dc000)
libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007f73f25a6000)
libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f73f24e5000)
libaec.so.0 => /lib/x86_64-linux-gnu/libaec.so.0 (0x00007f73f24d9000)
libpoppler.so.126 => /lib/x86_64-linux-gnu/libpoppler.so.126 (0x00007f73f2144000)
libgif.so.7 => /lib/x86_64-linux-gnu/libgif.so.7 (0x00007f73f2139000)
libnetcdf.so.19 => /lib/x86_64-linux-gnu/libnetcdf.so.19 (0x00007f73f1f3d000)
libcfitsio.so.10 => /lib/x86_64-linux-gnu/libcfitsio.so.10 (0x00007f73f1c21000)
libhdf5_serial.so.103 => /lib/x86_64-linux-gnu/libhdf5_serial.so.103 (0x00007f73f1868000)
libwebp.so.7 => /lib/x86_64-linux-gnu/libwebp.so.7 (0x00007f73f17e9000)
libsqlite3.so.0 => /lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f73f1679000)
libpq.so.5 => /lib/x86_64-linux-gnu/libpq.so.5 (0x00007f73f1622000)
libopenjp2.so.7 => /lib/x86_64-linux-gnu/libopenjp2.so.7 (0x00007f73f15be000)
libkmlbase.so.1 => /lib/x86_64-linux-gnu/libkmlbase.so.1 (0x00007f73f15a1000)
libkmldom.so.1 => /lib/x86_64-linux-gnu/libkmldom.so.1 (0x00007f73f14ff000)
libkmlengine.so.1 => /lib/x86_64-linux-gnu/libkmlengine.so.1 (0x00007f73f14c5000)
libfyba.so.0 => /lib/x86_64-linux-gnu/libfyba.so.0 (0x00007f73f146d000)
libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f73f13d2000)
libspatialite.so.8 => /lib/x86_64-linux-gnu/libspatialite.so.8 (0x00007f73f0c2c000)
libmariadb.so.3 => /lib/x86_64-linux-gnu/libmariadb.so.3 (0x00007f73f0bd6000)
libfreexl.so.1 => /lib/x86_64-linux-gnu/libfreexl.so.1 (0x00007f73f0bc5000)
libogdi.so.4.1 => /lib/libogdi.so.4.1 (0x00007f73f0ba6000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f73f0b7b000)
libjson-c.so.5 => /lib/x86_64-linux-gnu/libjson-c.so.5 (0x00007f73f0b68000)
libdfalt.so.0 => /lib/libdfalt.so.0 (0x00007f73f0ac0000)
libmfhdfalt.so.0 => /lib/libmfhdfalt.so.0 (0x00007f73f0a97000)
libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f73f0841000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f73f081b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f73f5604000)
libgeos.so.3.13.0 => /usr/local/lib/libgeos.so.3.13.0 (0x00007f73f0501000)
libnghttp2.so.14 => /lib/x86_64-linux-gnu/libnghttp2.so.14 (0x00007f73f04d2000)
libidn2.so.0 => /lib/x86_64-linux-gnu/libidn2.so.0 (0x00007f73f049f000)
librtmp.so.1 => /lib/x86_64-linux-gnu/librtmp.so.1 (0x00007f73f0480000)
libssh2.so.1 => /lib/x86_64-linux-gnu/libssh2.so.1 (0x00007f73f0438000)
libpsl.so.5 => /lib/x86_64-linux-gnu/libpsl.so.5 (0x00007f73f0424000)
libnettle.so.8 => /lib/x86_64-linux-gnu/libnettle.so.8 (0x00007f73f03d2000)
libgnutls.so.30 => /lib/x86_64-linux-gnu/libgnutls.so.30 (0x00007f73f01b9000)
libgssapi_krb5.so.2 => /lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f73f0166000)
libldap-2.5.so.0 => /lib/x86_64-linux-gnu/libldap-2.5.so.0 (0x00007f73f0107000)
liblber-2.5.so.0 => /lib/x86_64-linux-gnu/liblber-2.5.so.0 (0x00007f73f00f5000)
libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007f73f00e7000)
libltdl.so.7 => /lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f73f00dc000)
libicuuc.so.72 => /lib/x86_64-linux-gnu/libicuuc.so.72 (0x00007f73efed7000)
libsnappy.so.1 => /lib/x86_64-linux-gnu/libsnappy.so.1 (0x00007f73efecb000)
libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x00007f73efe5b000)
liblapack.so.3 => /lib/x86_64-linux-gnu/liblapack.so.3 (0x00007f73ef75b000)
libarpack.so.2 => /lib/x86_64-linux-gnu/libarpack.so.2 (0x00007f73ef711000)
libsuperlu.so.6 => /lib/x86_64-linux-gnu/libsuperlu.so.6 (0x00007f73ef69b000)
libLerc.so.4 => /lib/x86_64-linux-gnu/libLerc.so.4 (0x00007f73ef602000)
libjbig.so.0 => /lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f73ef5ef000)
libsharpyuv.so.0 => /lib/x86_64-linux-gnu/libsharpyuv.so.0 (0x00007f73ef5e7000)
libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f73ef51b000)
libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f73ef4d0000)
liblcms2.so.2 => /lib/x86_64-linux-gnu/liblcms2.so.2 (0x00007f73ef46d000)
libnss3.so => /lib/x86_64-linux-gnu/libnss3.so (0x00007f73ef30e000)
libsmime3.so => /lib/x86_64-linux-gnu/libsmime3.so (0x00007f73ef2df000)
libplc4.so => /lib/x86_64-linux-gnu/libplc4.so (0x00007f73ef2d8000)
libnspr4.so => /lib/x86_64-linux-gnu/libnspr4.so (0x00007f73ef296000)
libhdf5_serial_hl.so.100 => /lib/x86_64-linux-gnu/libhdf5_serial_hl.so.100 (0x00007f73ef272000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f73ef25d000)
libcurl.so.4 => /lib/x86_64-linux-gnu/libcurl.so.4 (0x00007f73ef19d000)
libsz.so.2 => /lib/x86_64-linux-gnu/libsz.so.2 (0x00007f73ef198000)
libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f73ef0ed000)
libminizip.so.1 => /lib/x86_64-linux-gnu/libminizip.so.1 (0x00007f73ef0df000)
liburiparser.so.1 => /lib/x86_64-linux-gnu/liburiparser.so.1 (0x00007f73ef0c4000)
libfyut.so.0 => /lib/x86_64-linux-gnu/libfyut.so.0 (0x00007f73ef0b9000)
libfygm.so.0 => /lib/x86_64-linux-gnu/libfygm.so.0 (0x00007f73ef0b0000)
librttopo.so.1 => /lib/x86_64-linux-gnu/librttopo.so.1 (0x00007f73ef03b000)
libtirpc.so.3 => /lib/x86_64-linux-gnu/libtirpc.so.3 (0x00007f73ef00c000)
libunistring.so.5 => /lib/x86_64-linux-gnu/libunistring.so.5 (0x00007f73eee5a000)
libhogweed.so.6 => /lib/x86_64-linux-gnu/libhogweed.so.6 (0x00007f73eee11000)
libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007f73eed8d000)
libp11-kit.so.0 => /lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f73eebef000)
libtasn1.so.6 => /lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f73eebda000)
libkrb5.so.3 => /lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f73eeafc000)
libk5crypto.so.3 => /lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f73eeacf000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f73eeac9000)
libkrb5support.so.0 => /lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f73eeabb000)
libsasl2.so.2 => /lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f73eea9f000)
libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007f73eea7a000)
libicudata.so.72 => /lib/x86_64-linux-gnu/libicudata.so.72 (0x00007f73ecca8000)
libgfortran.so.5 => /lib/x86_64-linux-gnu/libgfortran.so.5 (0x00007f73ec9d5000)
libnssutil3.so => /lib/x86_64-linux-gnu/libnssutil3.so (0x00007f73ec9a2000)
libplds4.so => /lib/x86_64-linux-gnu/libplds4.so (0x00007f73ec99d000)
libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007f73ec98e000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f73ec987000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f73ec976000)
You also want to make sure the geos version it is linked to is the same as the geos version postgis-3 links to.
Another thought I have is maybe it's relying on postgis for the geos, which is different from the one GDAL is compiled with.
Not sure what happens in such a scenario. Because gdal brings in a dependency to GEOS and postgis_raster itself has a direct dependency to geos via the baked in liblwgeom.
More information about the postgis-users
mailing list