vagetablechicken opened a new issue #5182: URL: https://github.com/apache/incubator-doris/issues/5182
**Describe the bug** ``` [ RUN ] PluginZipTest.http_normal the path: /root/doris-env/doris/be/ut_build_ASAN/test/plugin ASAN:DEADLYSIGNAL ================================================================= ==119381==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7f00020b70a0 bp 0x000000000400 sp 0x7effff2fcd90 T2) ==119381==The signal is caused by a READ memory access. ==119381==Hint: address points to the zero page. #0 0x7f00020b709f in _IO_fread (/lib64/libc.so.6+0x6f09f) #1 0xa4011b in doris::HttpTestHandler::handle(doris::HttpRequest*) (/root/doris-env/doris/be/ut_build_ASAN/test/plugin/plugin_zip_test+0xa4011b) ``` **To Reproduce** It's occasionally, but we can make a demo. The root cause is https://github.com/apache/incubator-doris/blob/44325ae850d0cda8f2675af5b6825acb246fb988/be/test/plugin/plugin_zip_test.cpp#L54 We can speculate that `fp==nullptr`, so the demo: ``` #include <cstdio> int main(){ FILE* fp = nullptr; char f[1024]; auto size = fread(f, 1, 1024, fp); return 0; } ``` asan it, will get report: ``` ASAN:DEADLYSIGNAL ================================================================= ==32155==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x7fb8a3fad1ca bp 0x7fff8ee18970 sp 0x7fff8ee18530 T0) ==32155==The signal is caused by a READ memory access. ==32155==Hint: address points to the zero page. #0 0x7fb8a3fad1c9 in _IO_fread (/lib/x86_64-linux-gnu/libc.so.6+0x6e1c9) #1 0x400649 in main (/home/hw/test/test_fread/a.out+0x400649) #2 0x7fb8a3f5f83f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2083f) #3 0x400568 in _start (/home/hw/test/test_fread/a.out+0x400568) ``` **Expected behavior** It's the fault of opening the source file, not the evHttpServer worker. And why did we open file failed? It's the wrong way to get the `dir_path`. We can build a demo to test: ``` int main(){ char buf[1024]; readlink("/proc/self/exe", buf, 1023); char* dir_path = dirname(buf); std::string path = std::string(dir_path); std::cout << path << std::endl; return 0; } ``` After run it multiple times, we can find some wrong results, e.g. ``` /root/doris-env/test/get_path/a.out^O /root/doris-env/test/get_path/a.out~Y /root/doris-env/test/get_path/a.out ... ``` So when the path is incorrect, we can't open file in `doris::HttpTestHandler::handle`, the plugin_zip_test will failed. I'll fix the way to get the folder containing the currently running executable. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org