LLVM version used for postgres packages on Centos 7 is very old and causes segfaults on OOM

From: Jelte Fennema <Jelte(dot)Fennema(at)microsoft(dot)com>
To: "pgsql-pkg-yum(at)lists(dot)postgresql(dot)org" <pgsql-pkg-yum(at)lists(dot)postgresql(dot)org>
Subject: LLVM version used for postgres packages on Centos 7 is very old and causes segfaults on OOM
Date: 2021-08-18 15:33:52
Message-ID: AM5PR83MB0178475D87EFA290A4D0793DF7FF9@AM5PR83MB0178.EURPRD83.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-pkg-yum

Hi,

Recently I ran into some segfaults under low memory conditions when enabling JIT. The reason turned out to be that the CentOS 7 packages for x86_64 are using LLVM 5, which is very old. Recompiling Postgres with LLVM 7 already helped quite a bit at reducing such crashes, presumably because it contains this change: https://github.com/llvm/llvm-project/commit/15681ad00b83c606dbb13af8782610a61bf39687

Looking at the spec files postgres is already built with LLVM 7 for ARM64 packages for CentOS 7.

Even with LLVM 7 there were still some segfaults related to out of memory issues in LLVM. The backtraces indicated that it would be fixed by this commit which is part of LLVM 8 and up: https://github.com/llvm/llvm-project/commit/50b33441487f9ccd447e17b1ecbd8799793993d4#

That commit replaces the line containing the following assert with actual error handling:
assert(!EC && "Failed to allocate resolver block");

After trying to reproduce the segfaults with LLVM 10, they completely disappeared.

So I have two questions:

1. Would it be feasible to use LLVM7 for the x86_64 packages as well? Just like is done
2. What would be required to build CentOS packages using LLVM8 or higher?

Jelte

Browse pgsql-pkg-yum by date

  From Date Subject
Next Message Devrim Gündüz 2021-08-26 15:05:21 Re: postgis for beta releases
Previous Message Justin Pryzby 2021-08-16 22:38:04 Re: postgis for beta releases