pgsql: Fix leak of LLVM "fatal-on-oom" section counter.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix leak of LLVM "fatal-on-oom" section counter.
Date: 2023-07-05 10:34:59
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-committers

Fix leak of LLVM "fatal-on-oom" section counter.

llvm_release_context() called llvm_enter_fatal_on_oom(), but was missing
the corresponding llvm_leave_fatal_on_oom() call. As a result, if JIT was
used at all, we were almost always in the "fatal-on-oom" state.

It only makes a difference if you use an extension written in C++, and
run out of memory in a C++ 'new' call. In that case, you would get a
PostgreSQL FATAL error, instead of the default behavior of throwing a
C++ exception.

Back-patch to all supported versions.

Reviewed-by: Daniel Gustafsson



Modified Files
src/backend/jit/llvm/llvmjit.c | 2 ++
1 file changed, 2 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2023-07-05 22:00:41 Re: pgsql: Clean up role created in new subscription test.
Previous Message Peter Eisentraut 2023-07-05 08:54:09 pgsql: pg_waldump: Add test case for notice message