ligangbin117 commented on issue #1606: URL: https://github.com/apache/brpc/issues/1606#issuecomment-2212885281
我在使用jni调用brpc的时候 也遇到了这个问题。 #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #1 0x00007f259f32ff95 in __GI_abort () at abort.c:79 #2 0x00007f259b95be09 in os::abort(bool) () from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/lib/amd64/server/libjvm.so #3 0x00007f259bb8367a in VMError::report_and_die() () from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/lib/amd64/server/libjvm.so #4 0x00007f259b965fb5 in JVM_handle_linux_signal () from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/lib/amd64/server/libjvm.so #5 0x00007f259b958fc8 in signalHandler(int, siginfo_t*, void*) () from /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.302.b08-0.el7_9.x86_64/jre/lib/amd64/server/libjvm.so #6 <signal handler called> #7 0x0000000000000000 in ?? () #8 0x00007f25a008b80a in ~ThreadExitHelper (this=0x55d1764021e0, __in_chrg=<optimized out>) at /root/volume/src/EDS5.1.0/eds-deps/src/brpc/src/butil/thread_local.cpp:41 #9 butil::detail::delete_thread_exit_helper (arg=0x55d1764021e0) at /root/volume/src/EDS5.1.0/eds-deps/src/brpc/src/butil/thread_local.cpp:80 #10 0x00007f259fce5a78 in __nptl_deallocate_tsd () at pthread_create.c:301 #11 0x00007f259fce698d in __nptl_deallocate_tsd () at ../sysdeps/nptl/futex-internal.h:82 #12 start_thread (arg=0x7f24d3031700) at pthread_create.c:488 #13 0x00007f259f3eebef in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 (gdb) p pd->specific $3 = {0x7f24d3031a10, 0x0 <repeats 31 times>} (gdb) p *pd->specific[0] $4 = {seq = 1, data = 0x0} (gdb) p __pthread_keys $5 = {{seq = 1, destr = 0x7f25a008b750 <butil::detail::delete_thread_exit_helper(void*)>}, {seq = 1, destr = 0x7f259f6b7340 <free_key_mem>}, {seq = 1, destr = 0x7f259b958bb0 <restore_thread_pointer(void*)>}, {seq = 1, destr = 0x7f25266e0420 <on_thread_exit>}, {seq = 0, destr = 0x0} <repeats 1020 times>} 我在butil/thread_local.cpp 文件 里面 注册和除 的时候 都 加了日志,但是只有删除 的时候 打印了日志: thread 0x7f24d3031700 key 0 delete 0x55d1764021e0 thread 0x7f24d3031700 fns 0x55d1764021e0 num 8737345935673 thread 0x7f25266d7270 first 0x7f25266d74c0 second (nil) thread 0x0 first 0x100000000 second (nil) 删除ThreadExitHelper传入的内存是有问题的。这个问题和brpc.so的加载 顺序有关系 。 开始是和 https://github.com/apache/brpc/issues/2266 这个问题有关,加载libbrpc.so会报 pthread_mutex_lock 未定义 通过https://github.com/apache/brpc/issues/1086这个方法,export LD_PRELOAD=/usr/lib64/libbrpc.so 解决了问题 但是在java线程退出的时候 就直接 core掉了。 我现在按照 https://github.com/apache/brpc/issues/2266 这个解决方案,将pthread_mutex_lock函数注释 掉。然后去掉export LD_PRELOAD=/usr/lib64/libbrpc.so是没有问题的。没搞清楚为什么使用export LD_PRELOAD=/usr/lib64/libbrpc.so 会有问题。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@brpc.apache.org For additional commands, e-mail: dev-h...@brpc.apache.org