Re: terminate called after throwing an instance of 'std::bad_alloc'
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org, Tom Lane <tgl@sss.pgh.pa.us>
Date: 2021-04-19T16:41:30Z
Lists: pgsql-hackers
Hi, On 2021-04-17 19:13:24 -0500, Justin Pryzby wrote: > I'm now realizing that that's RAM use for a single query, not from continuous > leaks across multiple queries. What's the memory usage with inlining disabled, and whats the usage without jit? > This is still true with the patch even if I > #define LLVMJIT_LLVM_CONTEXT_REUSE_MAX 1 > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 28438 postgres 20 0 3854264 2.8g 29428 R 98.7 33.2 8:56.79 postgres: telsasoft ts 192.168.122.11(53614) BIND > > python3 ./jitleak.py # runs telsasoft reports > INFO: recreating LLVM context after 2 uses > INFO: recreating LLVM context after 2 uses > INFO: recreating LLVM context after 2 uses > INFO: recreating LLVM context after 2 uses > INFO: recreating LLVM context after 2 uses > PID 27742 finished running report; est=None rows=40745; cols=34; ... duration:538 > INFO: recreating LLVM context after 81492 uses > > I did: > > - llvm_llvm_context_reuse_count = 0; > Assert(llvm_context != NULL); > + elog(INFO, "recreating LLVM context after %zu uses", llvm_llvm_context_reuse_count); > + llvm_llvm_context_reuse_count = 0; > > Maybe we're missing this condition somehow ? > if (llvm_jit_context_in_use_count == 0 && Do you utilize cursors or such? > Also, I just hit this assertion by cancelling the query with ^C / sigint. But > I don't have a reprodcer for it. > > < 2021-04-17 19:14:23.509 ADT telsasoft >PANIC: LLVMJitContext in use count not 0 at exit (is 1) Hm, I'll try to see how that happens - if not, do you have a backtrace? Greetings, Andres Freund
Commits
-
llvmjit: Use explicit LLVMContextRef for inlining
- 3b991f81c457 12.18 landed
- 10912f7d4ff0 13.14 landed
- 75a20a4b4b44 14.11 landed
- aef521849b68 15.6 landed
- 2cf50585e54a 16.2 landed
- 9dce22033d5d 17.0 landed