Unexpected abort at llvm::report_bad_alloc_error when load JIT library - Mailing list pgsql-hackers
From | Hugo Zhang |
---|---|
Subject | Unexpected abort at llvm::report_bad_alloc_error when load JIT library |
Date | |
Msg-id | ZQ0PR01MB10166732975BBA3FEB6472E19CAA9@ZQ0PR01MB1016.CHNPR01.prod.partner.outlook.cn Whole thread Raw |
List | pgsql-hackers |
Hi hackers,
I met a coredump when backend has no enough memory at dlopen which want to allocate memory for libLLVM-10.so.1.
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f10bde19859 in __GI_abort () at abort.c:79
#2 0x00007f109c24cc33 in llvm::report_bad_alloc_error(char const*, bool) () from /lib/x86_64-linux-gnu/libLLVM-10.so.1
#3 0x00007f109c23dc32 in ?? () from /lib/x86_64-linux-gnu/libLLVM-10.so.1
#4 0x00007f109c23dd6c in ?? () from /lib/x86_64-linux-gnu/libLLVM-10.so.1
#5 0x00007f109c2312db in llvm::cl::Option::addArgument() () from /lib/x86_64-linux-gnu/libLLVM-10.so.1
#6 0x00007f109c18c08e in ?? () from /lib/x86_64-linux-gnu/libLLVM-10.so.1
#7 0x00007f10c179fb9a in call_init (l=<optimized out>, argc=argc@entry=12, argv=argv@entry=0x7ffd8f53cc38,
env=env@entry=0x557459ba1ce0) at dl-init.c:72
#8 0x00007f10c179fca1 in call_init (env=0x557459ba1ce0, argv=0x7ffd8f53cc38, argc=12, l=<optimized out>) at dl-init.c:30
#9 _dl_init (main_map=0x557459e6e9d0, argc=12, argv=0x7ffd8f53cc38, env=0x557459ba1ce0) at dl-init.c:119
#10 0x00007f10bdf57985 in __GI__dl_catch_exception (exception=exception@entry=0x0,
operate=operate@entry=0x7f10c17a32d0 <call_dl_init>, args=args@entry=0x7ffd8f53ac70) at dl-error-skeleton.c:182
#11 0x00007f10c17a443d in dl_open_worker (a=a@entry=0x7ffd8f53ae20) at dl-open.c:758
#12 0x00007f10bdf57928 in __GI__dl_catch_exception (exception=exception@entry=0x7ffd8f53ae00,
operate=operate@entry=0x7f10c17a3c20 <dl_open_worker>, args=args@entry=0x7ffd8f53ae20) at dl-error-skeleton.c:208
#13 0x00007f10c17a360a in _dl_open (file=0x557459df2820 " /lib/postgresql/llvmjit.so", mode=-2147483390,
caller_dlopen=<optimized out>, nsid=-2, argc=12, argv=0x7ffd8f53cc38, env=0x557459ba1ce0) at dl-open.c:837
#14 0x00007f10bfa5134c in dlopen_doit (a=a@entry=0x7ffd8f53b040) at dlopen.c:66
#15 0x00007f10bdf57928 in __GI__dl_catch_exception (exception=exception@entry=0x7ffd8f53afe0,
operate=operate@entry=0x7f10bfa512f0 <dlopen_doit>, args=args@entry=0x7ffd8f53b040) at dl-error-skeleton.c:208
#16 0x00007f10bdf579f3 in __GI__dl_catch_error (objname=objname@entry=0x557459c9e450, errstring=errstring@entry=0x557459c9e458,
mallocedp=mallocedp@entry=0x557459c9e448, operate=operate@entry=0x7f10bfa512f0 <dlopen_doit>, args=args@entry=0x7ffd8f53b040)
at dl-error-skeleton.c:227
#17 0x00007f10bfa51b59 in _dlerror_run (operate=operate@entry=0x7f10bfa512f0 <dlopen_doit>, args=args@entry=0x7ffd8f53b040)
at dlerror.c:170
#18 0x00007f10bfa513da in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#19 0x0000557458502d07 in ?? ()
#20 0x0000557458503526 in load_external_function ()
#21 0x0000557458569c3d in ?? ()
#22 0x0000557458569e0e in jit_compile_expr ()
#23 0x000055745810d6c6 in ExecBuildProjectionInfoExt ()
#24 0x000055745812921b in ExecConditionalAssignProjectionInfo ()
#25 0x000055745814f12d in ExecInitSeqScanForPartition ()
#26 0x000055745812205c in ExecInitNode ()
#27 0x00005574581638ef in ExecInitMotion ()
#28 0x0000557458121ebc in ExecInitNode ()
#29 0x000055745811a544 in standard_ExecutorStart ()
#30 0x000055745838c059 in PortalStart ()
…
Platform : Ubuntu 20.04. x86_64 Linux 5.15.0-52-generic
Our llvmjit.h implemented the function llvm_enter_fatal_on_oom to FATAL out when llvm meet OOM, but when we load libLLVM.so, we may met some oom situation like upper stack that loaded there lib and want to init some options with memory allocation.
I didn’t figure out a better way to set an error_handler for this situation when load libLLVM.so.
- Hugo.
pgsql-hackers by date: