Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过 JNI 方式调用,ASAN 报错 #96

Open
Smith-Cruise opened this issue Mar 29, 2023 · 1 comment
Open

通过 JNI 方式调用,ASAN 报错 #96

Smith-Cruise opened this issue Mar 29, 2023 · 1 comment

Comments

@Smith-Cruise
Copy link

==2496223==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x60300060c070
    #0 0xcf4ca07 in free (/home/disk1/starrocks/output/be/lib/starrocks_be+0xcf4ca07)
    #1 0x7fa844d8ad32 in int JindoJniState::registerJniClassForInit<JindoNativeSystemClass>() (/tmp/libjindosdk-4384a5ce289bdd67_20230321_110550.so+0x38ad32)
    #2 0x7fa844c70823 in _GLOBAL__sub_I_JindoNative.cpp (/tmp/libjindosdk-4384a5ce289bdd67_20230321_110550.so+0x270823)
    #3 0x7fb684baa47d in call_init elf/dl-init.c:70
    #4 0x7fb684baa567 in call_init elf/dl-init.c:33
    #5 0x7fb684baa567 in _dl_init elf/dl-init.c:117
    #6 0x7fb6833d4c84 in __GI__dl_catch_exception elf/dl-error-skeleton.c:182
    #7 0x7fb684bb1ff5 in dl_open_worker elf/dl-open.c:808
    #8 0x7fb684bb1ff5 in dl_open_worker elf/dl-open.c:771
    #9 0x7fb6833d4c27 in __GI__dl_catch_exception elf/dl-error-skeleton.c:208
    #10 0x7fb684bb234d in _dl_open elf/dl-open.c:883
    #11 0x7fb6832f06bb in dlopen_doit dlfcn/dlopen.c:56
    #12 0x7fb6833d4c27 in __GI__dl_catch_exception elf/dl-error-skeleton.c:208
    #13 0x7fb6833d4cf2 in __GI__dl_catch_error elf/dl-error-skeleton.c:227
    #14 0x7fb6832f01ad in _dlerror_run dlfcn/dlerror.c:138
    #15 0x7fb6832f0747 in dlopen_implementation dlfcn/dlopen.c:71
    #16 0x7fb6832f0747 in ___dlopen dlfcn/dlopen.c:81
    #17 0xcee4fe2 in __interceptor_dlopen.part.0 (/home/disk1/starrocks/output/be/lib/starrocks_be+0xcee4fe2)
    #18 0x7fb6841fee30 in os::dll_load(char const*, char*, int) (/home/disk1/tools/jdk-11.0.2/lib/server/libjvm.so+0xbfee30)
    #19 0x7fb683f305c0 in JVM_LoadLibrary (/home/disk1/tools/jdk-11.0.2/lib/server/libjvm.so+0x9305c0)
    #20 0x7fb07720eeb7 in Java_java_lang_ClassLoader_00024NativeLibrary_load0 (/home/disk1/tools/jdk-11.0.2/lib/libjava.so+0xeeb7)
    #21 0x7fb05f668156  (<unknown module>)

是已知问题吗

@yanbinyang
Copy link
Collaborator

yanbinyang commented Mar 29, 2023

==2496223==ERROR: AddressSanitizer: alloc-dealloc-mismatch (operator new vs free) on 0x60300060c070
    #0 0xcf4ca07 in free (/home/disk1/starrocks/output/be/lib/starrocks_be+0xcf4ca07)
    #1 0x7fa844d8ad32 in int JindoJniState::registerJniClassForInit<JindoNativeSystemClass>() (/tmp/libjindosdk-4384a5ce289bdd67_20230321_110550.so+0x38ad32)
    #2 0x7fa844c70823 in _GLOBAL__sub_I_JindoNative.cpp (/tmp/libjindosdk-4384a5ce289bdd67_20230321_110550.so+0x270823)
    #3 0x7fb684baa47d in call_init elf/dl-init.c:70
    #4 0x7fb684baa567 in call_init elf/dl-init.c:33
    #5 0x7fb684baa567 in _dl_init elf/dl-init.c:117
    #6 0x7fb6833d4c84 in __GI__dl_catch_exception elf/dl-error-skeleton.c:182
    #7 0x7fb684bb1ff5 in dl_open_worker elf/dl-open.c:808
    #8 0x7fb684bb1ff5 in dl_open_worker elf/dl-open.c:771
    #9 0x7fb6833d4c27 in __GI__dl_catch_exception elf/dl-error-skeleton.c:208
    #10 0x7fb684bb234d in _dl_open elf/dl-open.c:883
    #11 0x7fb6832f06bb in dlopen_doit dlfcn/dlopen.c:56
    #12 0x7fb6833d4c27 in __GI__dl_catch_exception elf/dl-error-skeleton.c:208
    #13 0x7fb6833d4cf2 in __GI__dl_catch_error elf/dl-error-skeleton.c:227
    #14 0x7fb6832f01ad in _dlerror_run dlfcn/dlerror.c:138
    #15 0x7fb6832f0747 in dlopen_implementation dlfcn/dlopen.c:71
    #16 0x7fb6832f0747 in ___dlopen dlfcn/dlopen.c:81
    #17 0xcee4fe2 in __interceptor_dlopen.part.0 (/home/disk1/starrocks/output/be/lib/starrocks_be+0xcee4fe2)
    #18 0x7fb6841fee30 in os::dll_load(char const*, char*, int) (/home/disk1/tools/jdk-11.0.2/lib/server/libjvm.so+0xbfee30)
    #19 0x7fb683f305c0 in JVM_LoadLibrary (/home/disk1/tools/jdk-11.0.2/lib/server/libjvm.so+0x9305c0)
    #20 0x7fb07720eeb7 in Java_java_lang_ClassLoader_00024NativeLibrary_load0 (/home/disk1/tools/jdk-11.0.2/lib/libjava.so+0xeeb7)
    #21 0x7fb05f668156  (<unknown module>)

是已知问题吗

不是已知问题。registerJniClassForInit在jindo中是一个全局的static变量,里面存储的是jni回调函数的注册表。

怀疑可能是Static Initialization Order Fiasco引发的问题,不知道starocks be中是否也存在类似问题,导致了alloc-dealloc-mismatch。后续 jindo 会考虑引入Construct on first use避免该问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants