diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-07-05 13:13:13 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-07-05 13:13:35 +0300 |
commit | bfb493dbae7e460a7786daa7ba1522cc3eb6dac3 (patch) | |
tree | 47ab0d4dee513e81284103bb7ee973d532cc6a4b | |
parent | d85bf0719e71f483cdeb537cd0045913f587f743 (diff) | |
download | postgresql-bfb493dbae7e460a7786daa7ba1522cc3eb6dac3.tar.gz postgresql-bfb493dbae7e460a7786daa7ba1522cc3eb6dac3.zip |
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
Discussion: https://www.postgresql.org/message-id/54b78cca-bc84-dad8-4a7e-5b56f764fab5@iki.fi
-rw-r--r-- | src/backend/jit/llvm/llvmjit.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/jit/llvm/llvmjit.c b/src/backend/jit/llvm/llvmjit.c index e8eb83ebd38..a649deab4b8 100644 --- a/src/backend/jit/llvm/llvmjit.c +++ b/src/backend/jit/llvm/llvmjit.c @@ -221,6 +221,8 @@ llvm_release_context(JitContext *context) } list_free(llvm_context->handles); llvm_context->handles = NIL; + + llvm_leave_fatal_on_oom(); } /* |