When creating a UDF function in MySQL, mysqld loads the shared library where the C++ implementation of that function is defined. That library, in turn, depends on another shared library with a gRPC client code (the UDF is supposed to connect as a gRPC client to a gRPC server somewhere)
The result of the execution is this:
ERROR 2013 (HY000): Lost connection to MySQL server during query
Also, mysqld gets an exception at that time, with the stack below.
Note that the C++ code from both libraries works fine in a standalone program outside from MySQL.
Continuing to dig in, but appreciate if someone has a quick clue...
Thread 39 "mysqld" received signal SIGABRT, Aborted.
[Switching to Thread 0x7f2490117700 (LWP 2833353)]
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 return ret;
(gdb) where
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007f249ffa9b25 in __GI_abort () at abort.c:79
#2 0x00007f24a097406b in __gnu_cxx::__verbose_terminate_handler ()
at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007f24a097a50c in __cxxabiv1::__terminate (handler=<optimized out>)
at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:47
#4 0x00007f24a097a567 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:57
#5 0x00007f24a097a7c8 in __cxxabiv1::__cxa_throw (obj=<optimized out>,
tinfo=0x7f24a20c4918 <typeinfo for google::protobuf::FatalException>,
dest=0x7f24a1e9fe10 <google::protobuf::FatalException::~FatalException()>)
at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:95
#6 0x00007f24a1e64d9f in google::protobuf::internal::LogMessage::Finish() [clone .cold] ()
from /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4
#7 0x00007f24a1ea10d0 in google::protobuf::internal::VerifyVersion(int, int, char const*) ()
from /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4
#8 0x00007f2428a06761 in InitDefaultsscc_info_Any_google_2fprotobuf_2fany_2eproto() ()
from /usr/local/lib64/libprotobuf.so.3.12.2.0
#9 0x00007f24a1e8434a in google::protobuf::internal::(anonymous namespace)::InitSCC_DFS(google::protobuf::internal::SCCInfoBase*) () from /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4
#10 0x00007f24a1e85064 in google::protobuf::internal::InitSCCImpl(google::protobuf::internal::SCCInfoBase*) ()
from /usr/lib64/mysql/private/libprotobuf-lite.so.3.11.4
#11 0x00007f24643953e0 in google::protobuf::internal::InitSCC (
scc=0x7f2428f08fa0 <scc_info_Any_google_2fprotobuf_2fany_2eproto>)
at /usr/local/include/google/protobuf/generated_message_util.h:240
#12 0x00007f2428aead0a in google::protobuf::(anonymous namespace)::AddDescriptorsImpl(google::protobuf::internal::DescriptorTable const*) () from /usr/local/lib64/libprotobuf.so.3.12.2.0
#13 0x00007f2428aeae07 in google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*) () from /usr/local/lib64/libprotobuf.so.3.12.2.0
#14 0x00007f2428a078c4 in __static_initialization_and_destruction_0 () from /usr/local/lib64/libprotobuf.so.3.12.2.0
#15 0x00007f2428a078e1 in _GLOBAL__sub_I_any.pb.cc () from /usr/local/lib64/libprotobuf.so.3.12.2.0
#16 0x00007f24a22f6eca in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7ffe161151b8,
env=env@entry=0x7ffe161151c8) at dl-init.c:72
#17 0x00007f24a22f6fca in call_init (env=0x7ffe161151c8, argv=0x7ffe161151b8, argc=1, l=<optimized out>)
at dl-init.c:30
#18 _dl_init (main_map=0x7f242418da00, argc=1, argv=0x7ffe161151b8, env=0x7ffe161151c8) at dl-init.c:119
#19 0x00007f24a00c046c in __GI__dl_catch_exception (exception=exception@entry=0x0,
operate=operate@entry=0x7f24a22fa5d0 <call_dl_init>, args=args@entry=0x7f2490114020) at dl-error-skeleton.c:182
#20 0x00007f24a22fb108 in dl_open_worker (a=a@entry=0x7f24901141d0) at dl-open.c:755
#21 0x00007f24a00c0414 in __GI__dl_catch_exception (exception=exception@entry=0x7f24901141b0,
operate=operate@entry=0x7f24a22facc0 <dl_open_worker>, args=args@entry=0x7f24901141d0) at dl-error-skeleton.c:208
#22 0x00007f24a22fa8fe in _dl_open (file=0x7f2490114b00 "/usr/lib64/mysql/plugin/cryptomove_mysql.so",
mode=-2147483646, caller_dlopen=0xf963e6 <mysql_create_function(THD*, udf_func*)+3078>, nsid=<optimized out>,
argc=1, argv=<optimized out>, env=0x7ffe161151c8) at dl-open.c:834
#23 0x00007f24a10891ba in dlopen_doit (a=a@entry=0x7f24901143f0) at dlopen.c:66
#24 0x00007f24a00c0414 in __GI__dl_catch_exception (exception=exception@entry=0x7f2490114390,
operate=operate@entry=0x7f24a1089160 <dlopen_doit>, args=args@entry=0x7f24901143f0) at dl-error-skeleton.c:208
#25 0x00007f24a00c04d3 in __GI__dl_catch_error (objname=objname@entry=0x7f2424164370,
errstring=errstring@entry=0x7f2424164378, mallocedp=mallocedp@entry=0x7f2424164368,
operate=operate@entry=0x7f24a1089160 <dlopen_doit>, args=args@entry=0x7f24901143f0) at dl-error-skeleton.c:227
#26 0x00007f24a1089939 in _dlerror_run (operate=operate@entry=0x7f24a1089160 <dlopen_doit>,
args=args@entry=0x7f24901143f0) at dlerror.c:170
--Type <RET> for more, q to quit, c to continue without paging--
#27 0x00007f24a108925a in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#28 0x0000000000f963e6 in mysql_create_function(THD*, udf_func*) ()
#29 0x0000000000ed4e44 in mysql_execute_command(THD*, bool) ()
#30 0x0000000000ed695b in mysql_parse(THD*, Parser_state*) ()
#31 0x0000000000ed8cdc in dispatch_command(THD*, COM_DATA const*, enum_server_command) ()
#32 0x0000000000ed9984 in do_command(THD*) ()
#33 0x0000000001002260 in handle_connection ()
#34 0x0000000002754042 in pfs_spawn_thread ()
#35 0x00007f24a20cf2de in start_thread (arg=<optimized out>) at pthread_create.c:486
#36 0x00007f24a0083e83 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) c
Continuing.
[Thread 0x7f249217f700 (LWP 2833351) exited]
[Thread 0x7f2490117700 (LWP 2833353) exited]
[Thread 0x7f2464ff9700 (LWP 2833352) exited]
[Thread 0x7f24921c6700 (LWP 2833350) exited]
[Thread 0x7f249220e700 (LWP 2833349) exited]
[Thread 0x7f2492256700 (LWP 2833348) exited]
[Thread 0x7f24657fa700 (LWP 2833347) exited]
[Thread 0x7f2465ffb700 (LWP 2833346) exited]
[Thread 0x7f24667fc700 (LWP 2833345) exited]
[Thread 0x7f2466ffd700 (LWP 2833344) exited]
[Thread 0x7f249406f700 (LWP 2833342) exited]
[Thread 0x7f249229d700 (LWP 2833338) exited]
[Thread 0x7f24922e4700 (LWP 2833337) exited]
[Thread 0x7f249232b700 (LWP 2833336) exited]
[Thread 0x7f2467fff700 (LWP 2833335) exited]
[Thread 0x7f2474cf3700 (LWP 2833334) exited]
[Thread 0x7f24754f4700 (LWP 2833333) exited]
[Thread 0x7f2475cf5700 (LWP 2833332) exited]
[Thread 0x7f24764f6700 (LWP 2833331) exited]
[Thread 0x7f2476cf7700 (LWP 2833330) exited]
[Thread 0x7f2479cfd700 (LWP 2833329) exited]
[Thread 0x7f24774f8700 (LWP 2833328) exited]
[Thread 0x7f2477cf9700 (LWP 2833327) exited]
[Thread 0x7f24784fa700 (LWP 2833326) exited]
[Thread 0x7f2478cfb700 (LWP 2833325) exited]
[Thread 0x7f24794fc700 (LWP 2833324) exited]
[Thread 0x7f2488ff9700 (LWP 2833322) exited]
[Thread 0x7f24897fa700 (LWP 2833321) exited]
[Thread 0x7f2489ffb700 (LWP 2833320) exited]
[Thread 0x7f248a7fc700 (LWP 2833319) exited]
[Thread 0x7f248affd700 (LWP 2833318) exited]
[Thread 0x7f248b7fe700 (LWP 2833317) exited]
[Thread 0x7f248bfff700 (LWP 2833316) exited]
[Thread 0x7f2490b44700 (LWP 2833315) exited]
[Thread 0x7f2491345700 (LWP 2833314) exited]
[Thread 0x7f2491b46700 (LWP 2833313) exited]
[Thread 0x7f2492d90700 (LWP 2833312) exited]
[Thread 0x7f24a24f9800 (LWP 2833309) exited]
[Inferior 1 (process 2833309) exited with code 02]
(gdb)