Llvmjit.so fails to load in percona-postgresql-17 container

Hello, I have encountered this issue while working with this image: perconalab/percona-distribution-postgresql-with-postgis:17.9.

When PostgreSQL’s JIT compiler activates, loading /usr/pgsql-17/lib/llvmjit.so fails with:

ERROR: could not load library "/usr/pgsql-17/lib/llvmjit.so":
/usr/pgsql-17/lib/llvmjit.so: undefined symbol: _ZSt21__glibcxx_assert_failPKciS0_S0_

This causes intermittent errors on queries whose estimated cost exceeds jit_above_cost. In our case, PostGIS tile generation via a tileserver triggers it at certain zoom levels.

Doing some research, maybe the issue is that llvmjit.so was compiled against a libstdc++ version that exports _ZSt21__glibcxx_assert_failPKciS0_S0_ (introduced in GLIBCXX_3.4.33, GCC 14+), but the container ships libstdc++.so.6.0.29 which only supports up to GLIBCXX_3.4.29 (GCC 11).

Verified in the container with:

$ nm -D /usr/pgsql-17/lib/llvmjit.so | grep glibcxx_assert_fail
                 U _ZSt21__glibcxx_assert_failPKciS0_S0_
$ nm -D /usr/lib64/libstdc++.so.6 | grep glibcxx_assert_fail
(no output)
$ strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX | tail -3
GLIBCXX_3.4.28
GLIBCXX_3.4.29
GLIBCXX_DEBUG_MESSAGE_LENGTH

In the docker image for Postgres 17.9, the version of libstdc++ is 6.0.33 and contains:

$ nm -D "libstdc++.so.6.0.33" | grep glibcxx_assert_fail
00000000000d5400 T _ZSt21__glibcxx_assert_failPKciS0_S0_@@GLIBCXX_3.4.30

The version in your container is libstdc++.so.6.0.29.

My current workaround is to disable jit.

Can you verify those commands below inside the container and send us the output?

ldd /usr/pgsql-17/lib/llvmjit.so
readelf -Ws /usr/pgsql-17/lib/llvmjit.so | grep glibcxx_assert_fail
readelf -V /usr/lib64/libstdc++.so.6 | grep GLIBCXX | tail
rpm -q percona-postgresql17-llvmjit libstdc++
cat /etc/redhat-release

Warm regards.

Hi, thank you for the quick response.

Here are the commands outputs:

bash-5.1$ ldd /usr/pgsql-17/lib/llvmjit.so
	linux-vdso.so.1 (0x000071ff203df000)
	libz.so.1 => /lib64/libz.so.1 (0x000071ff1cb70000)
	libzstd.so.1 => /lib64/libzstd.so.1 (0x000071ff1cab9000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x000071ff1c890000)
	libm.so.6 => /lib64/libm.so.6 (0x000071ff1c7b5000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000071ff1c796000)
	libc.so.6 => /lib64/libc.so.6 (0x000071ff1c58d000)
	/lib64/ld-linux-x86-64.so.2 (0x000071ff203e1000)
bash-5.1$ readelf -Ws /usr/pgsql-17/lib/llvmjit.so | grep glibcxx_assert_fail
   354: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND _ZSt21__glibcxx_assert_failPKciS0_S0_
bash-5.1$ readelf -V /usr/lib64/libstdc++.so.6 | grep GLIBCXX | tail
  0x0398: Rev: 1  Flags: none  Index: 27  Cnt: 2  Name: GLIBCXX_3.4.25
  0x03b4: Parent 1: GLIBCXX_3.4.24
  0x03bc: Rev: 1  Flags: none  Index: 28  Cnt: 2  Name: GLIBCXX_3.4.26
  0x03d8: Parent 1: GLIBCXX_3.4.25
  0x03e0: Rev: 1  Flags: none  Index: 29  Cnt: 2  Name: GLIBCXX_3.4.27
  0x03fc: Parent 1: GLIBCXX_3.4.26
  0x0404: Rev: 1  Flags: none  Index: 30  Cnt: 2  Name: GLIBCXX_3.4.28
  0x0420: Parent 1: GLIBCXX_3.4.27
  0x0428: Rev: 1  Flags: none  Index: 31  Cnt: 2  Name: GLIBCXX_3.4.29
  0x0444: Parent 1: GLIBCXX_3.4.28
bash-5.1$ rpm -q percona-postgresql17-llvmjit libstdc++
percona-postgresql17-llvmjit-17.9-1.el9.x86_64
libstdc++-11.5.0-11.0.2.el9.x86_64
bash-5.1$ cat /etc/redhat-release
Red Hat Enterprise Linux release 9.7 (Plow)

Kind regards

Hi Chemp,

Thank you for the output.

We can see clearly:

  • llvmjit.so has an unresolved dependency on _ZSt21__glibcxx_assert_failPKciS0_S0_.

  • The container resolves libstdc++.so.6 to /lib64/libstdc++.so.6, but that library only exports symbols up to GLIBCXX_3.4.29.

  • The installed packages confirm the mismatch: percona-postgresql17-llvmjit-17.9-1.el9.x86_64 with libstdc++-11.5.0...el9, on RHEL/UBI 9.7.

The container has libstdc++-11.5.0 symbol versions only up to GLIBCXX_3.4.29, while the llvmjit.so package appears to have been built with headers/runtime expectations from a newer libstdc++. So we consider the issue is not specific to PostGIS itself.

We can see you are using an image: perconalab/percona-distribution-postgresql-with-postgis:17.9.

May we ask you to try this image below instead? We tested on this image and didn’t see any issues.

percona/percona-distribution-postgresql:17.9

Warm regards.

Good morning,

I have tested on percona/percona-distribution-postgresql:17.9 as you suggested. In a fresh container:

demo=# SELECT pg_jit_available();
ERROR:  could not load library "/usr/pgsql-17/lib/llvmjit.so": /usr/pgsql-17/lib/llvmjit.so: undefined symbol: _ZSt21__glibcxx_assert_failPKciS0_S0_
demo=# SHOW jit_provider;
 jit_provider 
--------------
 llvmjit
(1 row)

Installed packages in that image:

$ rpm -q percona-postgresql17-llvmjit libstdc++ && cat /etc/redhat-release
percona-postgresql17-llvmjit-17.9-1.el9.x86_64
libstdc++-11.5.0-11.0.2.el9.x86_64
Red Hat Enterprise Linux release 9.7 (Plow)

Running pg_jit_available() is the simplest way I was able to replicate the error, without changing any jit settings.

Kind regards