Ericsson / CodeCompass

CodeCompass is a software comprehension tool for large scale software written in C/C++ and Java
https://codecompass.net
GNU General Public License v3.0
520 stars 102 forks source link

SQL Indexe commands crash when running CodeCompass_parser #476

Closed shijunjing closed 3 years ago

shijunjing commented 4 years ago

Hello, I meet a SQL commands running crash when use CodeCompass_parser to setup the PostgreSQL database for my project. Below is the crash log:

~/CodeCompass/install/bin/CodeCompass_parser -d "pgsql:host=localhost;port=5433;user=compass;password=123456;database=mydatabase" -w /home/jshi19/CodeCompass/workspace -n edk2 -i /home/jshi19/wksp_efi/edk2-2/build_commands.json -i /home/jshi19/wksp_efi/edk2-2 -j 16 
... ...
[INFO] Recursive directory iteration: visited 45681 files in 3922 directories so far.
[INFO] Indexed 22,577 file(s)
[INFO] Modified 0 file(s)
[INFO] Indexer finished!
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppenum-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppfriendship-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/buildlog-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/metrics-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cpprecord-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/filecontent-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/statistics-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cpptype-odb.sql
[WARNING] Exception when running SQL command: 42P07: ERROR:  relation "CppMemberType_memberAstNode_i" already exists

Exception when running SQL command: 42P07: ERROR:  relation "CppMemberType_memberAstNode_i" already exists

After quickly search the "CppMemberType_memberAstNode_i", I found there are two installed sql files containing the same "CppMemberType_memberAstNode_i" index creation SQL commands as below.

CREATE UNIQUE INDEX "CppMemberType_memberAstNode_i"
  ON "CppMemberType" ("memberAstNode");

ALTER TABLE "CppMemberType"
  ADD CONSTRAINT "memberAstNode_fk"
    FOREIGN KEY ("memberAstNode")
    REFERENCES "CppAstNode" ("id")
    ON DELETE CASCADE
    INITIALLY DEFERRED;

Is there any configure I need to set to avoid the SQL commands conflict? Appreciate if you could give me a hint.

Steven Thanks

mcserep commented 4 years ago

Hello Steven,

Thanks for your report. The CppType class was recently renamed to CppRecord (see #468). It looks like you still have the old corresponding cpptype-odb.sql file in your CodeCompass install folder, as it wasn't removed when making an incremental build and install. It shouldn't be there.

I recommend to do a clean build and install of CodeCompass, that should solve such an issue.

shijunjing commented 4 years ago

Hi Mcserep, Thank you for the suggestion. I removed my CodeCompass old install directory and reinstall again, the cpptype-odb.sql is removed and "CppMemberType_memberAstNode_i" exception issue disappeared. However, I meet a new crash in cppfunction-odb.sql. Below is my build crash log. Could you advise how could I debug this issue? What configures I might set to output more debug info?

[INFO] Indexed 22,577 file(s)
[INFO] Modified 0 file(s)
[INFO] Indexer finished!
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppenum-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppfriendship-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/buildlog-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/metrics-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cpprecord-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/filecontent-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/statistics-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/file-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/position-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppmacroexpansion-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppheaderinclusion-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppnamespace-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/buildaction-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppvariable-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppinheritance-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cpprelation-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppentity-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppdoccomment-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cpptypedef-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppedge-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppastnode-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/fileloc-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/buildsourcetarget-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppmacro-odb.sql
[INFO] Creating indexes from file /home/jshi19/CodeCompass/install/share/codecompass/sql/cppfunction-odb.sql
Segmentation fault (core dumped)

If I continue to do the incremental parsing, database_exception happened as below:

jshi19@ub2-uefi-b01:~$ ~/CodeCompass/install/bin/CodeCompass_parser -d "pgsql:host=localhost;port=5433;user=compass;password=123456;database=mydatabase" -w /home/jshi19/CodeCompass/workspace -n edk2 -i /home/jshi19/wksp_efi/edk2-2/build_commands.json -i /home/jshi19/wksp_efi/edk2-2 -j 16
[INFO] Project already exists, incremental parsing in action.
[INFO] [cppparser] started to mark modified files!
[INFO] Indexer started! Mode: CREATE
[INFO] [dummyparser] started to mark modified files!
[INFO] [gitparser] started to mark modified files!
[INFO] [metricsparser] started to mark modified files!
[INFO] [searchparser] started to mark modified files!
[INFO] [cppparser] cleanup started!
... ...
[INFO] [searchparser] cleanup started!
... ...
[INFO] Database cleanup: /usr/include/modes_local.h
[INFO] Database cleanup: /usr/include/Library/RngLib.h
[INFO] Database cleanup: /usr/include/internal/refcount.h
[INFO] Database cleanup: /home/jshi19/wksp_efi/edk2-2/CryptoPkg/Library/OpensslLib/openssl/crypto/x509v3/v3_lib.c
[INFO] Database cleanup: /usr/include/internal
terminate called after throwing an instance of 'odb::pgsql::database_exception'
  what():  23503: ERROR:  update or delete on table "File" violates foreign key constraint "parent_fk" on table "File"
DETAIL:  Key (id)=(-2560891822207574491) is still referenced from table "File".
Aborted (core dumped)

My detail build steps is here: https://github.com/shijunjing/edk2/wiki/CodeCompass-enabling. Any suggestion is appreciated.

mcserep commented 4 years ago

I am glad the original issue was fixed by the clean build of CodeCompass.

About your new issue with parsing (non-incremental): unfortunately for now it is quite normal on Ubuntu 20.04 that the parser finishes with a Segmentation fault. We know about this (#405), and while it seems bad, we observed that it actually does not affect the result, the parsing (including database index creation) was already done. You can move on and try to launch the webserver. This issue is only present on Ubuntu 20.04 (not on 18.04 and 16.04) and only with Release builds (not with Debug and RelWithDebInfo), making it harder for us the detect the cause. Eventually we will get to it sometime 😄

About the issue with incremental parsing: this failure shall not happen. While we continuously test incremental parsing on various projects (see: https://codecompass.net), of course it is possible that it contains a bug, as it is a more recently developed feature. First, we will try to reproduce the issue, if I see correctly, you tried to incrementally parse the project available at https://github.com/tianocore/edk2? After the initial parse, did you made any modifications on any source files or just tried to execute an incremental parsing on the unchanged codebase?

shijunjing commented 4 years ago

Hi Mcserep, Thank you a lot to reproduce my issue!

First, we will try to reproduce the issue, if I see correctly, you tried to incrementally parse the project available at https://github.com/tianocore/edk2?

Yes, I'm trying to enable the CodeCompass on the edk2, the Uefi firmware core. If you have trouble to build the edk2, just let me know.

After the initial parse, did you made any modifications on any source files or just tried to execute an incremental parsing on the unchanged codebase?

No, I didn't change anything. I only directly to try the incremental parsing after I met the non-incremental Segmentation fault.

Thanks Steven

shijunjing commented 4 years ago

Hi Mcserep,

We know about this (#405), and while it seems bad, we observed that it actually does not affect the result, the parsing (including database index creation) was already done. You can move on and try to launch the webserver.

I tried the webserver today, but the CodeCompass_webserver cannot find my PG database on port 5433. How could I tell the CodeCompass_webserver to connect PG on port 5433, not the port 5432? The postgresql default port 5432 already be used in my ubuntu 20.04, so I have to uses the 5433 as default port.

jshi19@ub2-uefi-b01:~$ ~/CodeCompass/install/bin/CodeCompass_webserver   -w /home/jshi19/CodeCompass/workspace/  -p 6251
terminate called after throwing an instance of 'odb::pgsql::database_exception'
  what():  could not connect to server: Connection refused
        Is the server running on host "localhost" (::1) and accepting
        TCP/IP connections on port 5432?
could not connect to server: Connection refused
        Is the server running on host "localhost" (127.0.0.1) and accepting
        TCP/IP connections on port 5432?

Aborted (core dumped)
mcserep commented 4 years ago

Hello Steven,

Can you check the connection string in the project_info.json file in the CodeCompass workspace directory? (Which I believe will be /home/jshi19/CodeCompass/workspace/edk2, based on your parsing command.) Check the database port and if it is 5432, modify it accordingly to what port you would like to use.

shijunjing commented 4 years ago

Hi Mcserep, Thank you! Changing the project_info.json works.

BTW, I see the CodeCompass LLVM project homepage has a "Jump to: src" shortcut link to go to project root directory. How could I create one for my edk2 project homepage?

image

intjftw commented 4 years ago

Hi Steven,

Either you may add the --label src= switch to the parsing command, or you can manually write labels into the project_info.json:

"labels": { "src": "\/path\/to\/source\/" }

Anett

On Thu, Oct 15, 2020 at 10:23 AM Shi Steven notifications@github.com wrote:

Hi Mcserep, Thank you! Changing the project_info.json works.

BTW, I see the CodeCompass LLVM project homepage has a "Jump to: src" shortcut link to go to project root directory. How could I create one for my edk2 project homepage?

[image: image] https://user-images.githubusercontent.com/3271389/96096149-1c0e9100-0f02-11eb-99da-b317f5e90bfb.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Ericsson/CodeCompass/issues/476#issuecomment-708986526, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGHKD47V4D3ZRQX3ZEUVIOLSK2WPNANCNFSM4SON7UAQ .

shijunjing commented 4 years ago

Hi Anett, Your suggestion works for me. Thank you!

shijunjing commented 4 years ago

Hi Mcserep, Anett, I find a issue that if I click any function pointer call in the web, the CodeCompass_webserver will crash with "Segmentation fault (core dumped)" certainly. E.g. In below C code, the gBS is a function table pointer of system services in line 313, if I click the ‘->OpenProtocol’ function, the CodeCompass_webserver crash immediately. image

The above code is in line 313 of https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/PciBusDxe/PciBus.c The gBS function table structure declaration and the ‘->OpenProtocol’ function pointer declaration are in line 1872 and line 1336 of https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Uefi/UefiSpec.h

The gBS function table pointer value is set dynamically, I guess CodeCompass has some problem to support the function member reference through structure pointer. Could you give me some advise how to debug this issue?

Steven Thanks

mcserep commented 4 years ago

Hello Steven,

Can you try and check whether you can reproduce this issue with the current master branch of the repository? (You will need to reparse the project.)

Thanks, Máté

shijunjing commented 4 years ago

Hello Mate, I tried the latest master code: rebuild, re-install the CodeCompass, and re-parse the edk2 project. But same crash result if click the the ‘->OpenProtocol’ function. image

This crash failure looks like a access out of bound (buffer overflow) issue, and I'm thinking to enable the LLVM address sanitizer to debug it. Have you ever tried to build the CodeCompass with Clang and enable the ASan option "-fno-omit-frame-pointer -fsanitize=address"? (https://clang.llvm.org/docs/AddressSanitizer.html)

Thanks Steven

mcserep commented 4 years ago

Hello Steven,

It looks like the issue was related to an incorrect handling of function pointer data members. I have submitted a pull request to fix it.

Side note: I usually use GDB with CLion and Valgrind to debug memory management issues like this. Of course this requires to compile CodeCompass with the -DCMAKE_BUILD_TYPE=Debug flag (or at least RelWithDebInfo), to get interpretable results.

Máté

shijunjing commented 4 years ago

Hello Mate, I enabled the LLVM Asan on CodeCompass today and the Asan find many memory leak, odr violation, and access error in odb code. Below is the Asan log about the SEGV crash when I click any function pointer call in the web that I reported in previous comments. Let me know if you hope to know my Asan enabling detail steps and how to reproduce those Asan errors.

jshi19@ub2-uefi-b01:~$ ~/CodeCompass/install/bin/CodeCompass_webserver   -w /home/jshi19/CodeCompass/workspace/   -p 6251
[WARNING] No 'certificate.pem' found in '--workspace', server running over conventional HTTP!
[INFO] Mongoose web server starting on port 6251
[INFO] Search server started!
[INFO] Start serving search for index /home/jshi19/CodeCompass/workspace/edk2/search
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1395316==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000078 (pc 0x7fac617b66eb bp 0x7fac6096d490 sp 0x7fac6096d3a0 T2)
==1395316==The signal is caused by a READ memory access.
==1395316==Hint: address points to the zero page.
    #0 0x7fac617b66eb in std::_Rb_tree<cc::model::Tag, cc::model::Tag, std::_Identity<cc::model::Tag>, std::less<cc::model::Tag>, std::allocator<cc::model::Tag> >::begin() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1011:55
    #1 0x7fac616cbbcb in std::set<cc::model::Tag, std::less<cc::model::Tag>, std::allocator<cc::model::Tag> >::begin() const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_set.h:345:21
    #2 0x7fac61695bab in cc::service::language::CppServiceHandler::getTags[abi:cxx11](std::vector<cc::model::CppAstNode, std::allocator<cc::model::CppAstNode> > const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:1532:36
    #3 0x7fac616bdd77 in cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const::'lambda'()::operator()() const /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:970:27
    #4 0x7fac616bd9ad in cc::util::internal::Holder<void>::Holder<cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const::'lambda'()>(cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const::'lambda'()) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:45:7
    #5 0x7fac616bd342 in auto cc::util::OdbTransaction::operator()<cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const::'lambda'()>(cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const::'lambda'()) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:127:7
    #6 0x7fac616bbf49 in cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6::operator()() const /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:966:5
    #7 0x7fac616aa68b in cc::util::internal::Holder<void>::Holder<cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6>(cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:45:7
    #8 0x7fac61686c98 in auto cc::util::OdbTransaction::operator()<cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6>(cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&)::$_6) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:127:7
    #9 0x7fac616863d9 in cc::service::language::CppServiceHandler::getReferences(std::vector<cc::service::language::AstNodeInfo, std::allocator<cc::service::language::AstNodeInfo> >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:604:3
    #10 0x7fac61be0322 in cc::service::language::LanguageServiceProcessor::process_getReferences(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*) /home/jshi19/CodeCompass/CodeCompass/Build/service/language/gen-cpp/LanguageService.cpp:7046:13
    #11 0x7fac61bcaee2 in cc::service::language::LanguageServiceProcessor::dispatchCall(apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, void*) /home/jshi19/CodeCompass/CodeCompass/Build/service/language/gen-cpp/LanguageService.cpp:6227:3
    #12 0x7fac6181631c in cc::webserver::ThriftHandler<cc::service::language::LanguageServiceProcessor>::LoggingProcessor::dispatchCall(apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, void*) /home/jshi19/CodeCompass/CodeCompass/webserver/include/webserver/thrifthandler.h:60:25
    #13 0x7fac61816160 in apache::thrift::TDispatchProcessor::process(std::shared_ptr<apache::thrift::protocol::TProtocol>, std::shared_ptr<apache::thrift::protocol::TProtocol>, void*) /home/jshi19/CodeCompass/thrift_install/include/thrift/TDispatchProcessor.h:121:12
    #14 0x7fac61812ad3 in cc::webserver::ThriftHandler<cc::service::language::LanguageServiceProcessor>::beginRequest(mg_connection*) /home/jshi19/CodeCompass/CodeCompass/webserver/include/webserver/thrifthandler.h:105:18
    #15 0x5f6eb8 in cc::webserver::MainRequestHandler::begin_request_handler(mg_connection*) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:79:21
    #16 0x5fb62a in cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1::operator()() const /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:155:43
    #17 0x5f9c09 in auto cc::webserver::MainRequestHandler::executeWithSessionContext<cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1>(cc::webserver::Session*, cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:62:19
    #18 0x5f7fad in cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:154:10
    #19 0x5bcc32 in std::_Function_handler<int (mg_connection*, mg_event), cc::webserver::MainRequestHandler>::_M_invoke(std::_Any_data const&, mg_connection*&&, mg_event&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
    #20 0x616462 in std::function<int (mg_connection*, mg_event)>::operator()(mg_connection*, mg_event) const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
    #21 0x614dfd in cc::webserver::ThreadedMongoose::delegater(mg_connection*, mg_event) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:65:12
    #22 0x641be3 in call_user /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:1572:5
    #23 0x6497ef in call_request_handler /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:2791:17
    #24 0x644d3e in call_request_handler_if_data_is_buffered /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:3039:7
    #25 0x6443c2 in on_recv_data /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4386:5
    #26 0x64066f in mg_ev_handler /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4923:9
    #27 0x63a36e in ns_call /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:430:31
    #28 0x63a8c9 in ns_read_from_socket /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:789:7
    #29 0x63a190 in ns_server_poll /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:912:9
    #30 0x63f3ca in mg_poll_server /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4570:10
    #31 0x614dac in cc::webserver::ThreadedMongoose::serve(void*) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:55:5
    #32 0x61c11e in void* std::__invoke_impl<void*, void* (*)(void*), mg_server*>(std::__invoke_other, void* (*&&)(void*), mg_server*&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:60:14
    #33 0x61c021 in std::__invoke_result<void* (*)(void*), mg_server*>::type std::__invoke<void* (*)(void*), mg_server*>(void* (*&&)(void*), mg_server*&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:95:14
    #34 0x61bfe4 in void* std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:244:13
    #35 0x61bf94 in std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> >::operator()() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:251:11
    #36 0x61bcbd in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> > >::_M_run() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:195:13
    #37 0x7fac6fe58d83  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6d83)
    #38 0x7fac7002e608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8
    #39 0x7fac6fb3b292 in clone /build/glibc-ZN95T4/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_tree.h:1011:55 in std::_Rb_tree<cc::model::Tag, cc::model::Tag, std::_Identity<cc::model::Tag>, std::less<cc::model::Tag>, std::allocator<cc::model::Tag> >::begin() const
Thread T2 created by T0 here:
    #0 0x526faa in pthread_create /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:214:3
    #1 0x7fac6fe59048 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd7048)
    #2 0x615d86 in void cc::webserver::ThreadedMongoose::run<void>(void*, std::function<int (mg_connection*, mg_event)>) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.h:122:27
    #3 0x614c70 in cc::webserver::ThreadedMongoose::run(std::function<int (mg_connection*, mg_event)>) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:43:3
    #4 0x57335c in main /home/jshi19/CodeCompass/CodeCompass/webserver/src/webserver.cpp:164:16
    #5 0x7fac6fa400b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16

==1395316==ABORTING

Thanks Steven

mcserep commented 4 years ago

Hello Steven,

Thank your for your feedback. As mentioned in my previous comment I already managed to trace back the source of the crash and fixed it in #486. I have parsed the EDK II project you linked before and the issue was resolved with that fix.

Your dumped stack trace points to the very same error (in the CppServiceHandler::getTags() method), so until it gets merged to master (which will happen soon), feel free to check out my branch containing the bugfix or apply it manually to your copy of the CodeCompass codebase.

Regards, Máté

mcserep commented 4 years ago

The related PR has been merged, so by pulling the master branch it shall work now.

shijunjing commented 4 years ago

Hi Mate, Thank you to merge the fix and I can click the function pointer in the web now. But I still find the webserver is not stable and easy to crash if I random click code in the web for a while. I reproduced such crash several times when click the code of https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/PciBusDxe/PciCommand.c. It looks the crash happens at the CppEntity::CppEntity() every time. Below is the crash Asan log:

jshi19@ub2-uefi-b01:~$ ~/CodeCompass/install_asan/bin/CodeCompass_webserver   -w /home/jshi19/CodeCompass/workspace/   -p 6251
[WARNING] No 'certificate.pem' found in '--workspace', server running over conventional HTTP!
[INFO] Mongoose web server starting on port 6251
[INFO] Search server started!
[INFO] Start serving search for index /home/jshi19/CodeCompass/workspace/edk2/search
AddressSanitizer:DEADLYSIGNAL
=================================================================
==1460259==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000008 (pc 0x7fd11d60ec5b bp 0x7fd10dda8d40 sp 0x7fd10dda84f8 T2)
==1460259==The signal is caused by a READ memory access.
==1460259==Hint: address points to the zero page.
    #0 0x7fd11d60ec5b in memcpy /build/glibc-ZN95T4/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:142
    #1 0x53b737 in __asan_memcpy /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cpp:22:3
    #2 0x7fd10eb1d255 in cc::model::CppEntity::CppEntity(cc::model::CppEntity const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/model/include/model/cppentity.h:20:8
    #3 0x7fd10eb1d0b9 in cc::model::CppTypedEntity::CppTypedEntity(cc::model::CppTypedEntity const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/model/include/model/cppentity.h:43:8
    #4 0x7fd10eb1c399 in cc::model::CppFunction::CppFunction(cc::model::CppFunction const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/model/include/model/cppfunction.h:15:8
    #5 0x7fd10eadbedc in cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_4::operator()() const /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:295:39
    #6 0x7fd10eada96d in cc::util::internal::Holder<void>::Holder<cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_4>(cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_4) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:45:7
    #7 0x7fd10eabcfd2 in auto cc::util::OdbTransaction::operator()<cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_4>(cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)::$_4) /home/jshi19/CodeCompass/CodeCompass/util/include/util/odbtransaction.h:127:7
    #8 0x7fd10eabc8e6 in cc::service::language::CppServiceHandler::getProperties(std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) /home/jshi19/CodeCompass/CodeCompass/plugins/cpp/service/src/cppservice.cpp:274:3
    #9 0x7fd10f00be6c in cc::service::language::LanguageServiceProcessor::process_getProperties(int, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, void*) /home/jshi19/CodeCompass/CodeCompass/BuildAsan/service/language/gen-cpp/LanguageService.cpp:6536:13
    #10 0x7fd10f003f42 in cc::service::language::LanguageServiceProcessor::dispatchCall(apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, void*) /home/jshi19/CodeCompass/CodeCompass/BuildAsan/service/language/gen-cpp/LanguageService.cpp:6227:3
    #11 0x7fd10ec5110c in cc::webserver::ThriftHandler<cc::service::language::LanguageServiceProcessor>::LoggingProcessor::dispatchCall(apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int, void*) /home/jshi19/CodeCompass/CodeCompass/webserver/include/webserver/thrifthandler.h:60:25
    #12 0x7fd10ec50f50 in apache::thrift::TDispatchProcessor::process(std::shared_ptr<apache::thrift::protocol::TProtocol>, std::shared_ptr<apache::thrift::protocol::TProtocol>, void*) /usr/include/thrift/TDispatchProcessor.h:121:12
    #13 0x7fd10ec4d8c3 in cc::webserver::ThriftHandler<cc::service::language::LanguageServiceProcessor>::beginRequest(mg_connection*) /home/jshi19/CodeCompass/CodeCompass/webserver/include/webserver/thrifthandler.h:105:18
    #14 0x5f6eb8 in cc::webserver::MainRequestHandler::begin_request_handler(mg_connection*) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:79:21
    #15 0x5fb62a in cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1::operator()() const /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:155:43
    #16 0x5f9c09 in auto cc::webserver::MainRequestHandler::executeWithSessionContext<cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1>(cc::webserver::Session*, cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event)::$_1) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:62:19
    #17 0x5f7fad in cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event) /home/jshi19/CodeCompass/CodeCompass/webserver/src/mainrequesthandler.cpp:154:10
    #18 0x5bcc32 in std::_Function_handler<int (mg_connection*, mg_event), cc::webserver::MainRequestHandler>::_M_invoke(std::_Any_data const&, mg_connection*&&, mg_event&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:285:9
    #19 0x616462 in std::function<int (mg_connection*, mg_event)>::operator()(mg_connection*, mg_event) const /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/std_function.h:688:14
    #20 0x614dfd in cc::webserver::ThreadedMongoose::delegater(mg_connection*, mg_event) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:65:12
    #21 0x641be3 in call_user /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:1572:5
    #22 0x6497ef in call_request_handler /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:2791:17
    #23 0x644d3e in call_request_handler_if_data_is_buffered /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:3039:7
    #24 0x6443c2 in on_recv_data /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4386:5
    #25 0x64066f in mg_ev_handler /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4923:9
    #26 0x63a36e in ns_call /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:430:31
    #27 0x63a8c9 in ns_read_from_socket /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:789:7
    #28 0x63a190 in ns_server_poll /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:912:9
    #29 0x63f3ca in mg_poll_server /home/jshi19/CodeCompass/CodeCompass/webserver/src/mongoose.c:4570:10
    #30 0x614dac in cc::webserver::ThreadedMongoose::serve(void*) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:55:5
    #31 0x61c11e in void* std::__invoke_impl<void*, void* (*)(void*), mg_server*>(std::__invoke_other, void* (*&&)(void*), mg_server*&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:60:14
    #32 0x61c021 in std::__invoke_result<void* (*)(void*), mg_server*>::type std::__invoke<void* (*)(void*), mg_server*>(void* (*&&)(void*), mg_server*&&) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/invoke.h:95:14
    #33 0x61bfe4 in void* std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:244:13
    #34 0x61bf94 in std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> >::operator()() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:251:11
    #35 0x61bcbd in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void* (*)(void*), mg_server*> > >::_M_run() /usr/lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/thread:195:13
    #36 0x7fd11d98fd83  (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd6d83)
    #37 0x7fd11db65608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477:8
    #38 0x7fd11d672292 in clone /build/glibc-ZN95T4/glibc-2.31/misc/../sysdeps/unix/sysv/linux/x86_64/clone.S:95

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /build/glibc-ZN95T4/glibc-2.31/string/../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:142 in memcpy
Thread T2 created by T0 here:
    #0 0x526faa in pthread_create /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:214:3
    #1 0x7fd11d990048 in std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xd7048)
    #2 0x615d86 in void cc::webserver::ThreadedMongoose::run<void>(void*, std::function<int (mg_connection*, mg_event)>) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.h:122:27
    #3 0x614c70 in cc::webserver::ThreadedMongoose::run(std::function<int (mg_connection*, mg_event)>) /home/jshi19/CodeCompass/CodeCompass/webserver/src/threadedmongoose.cpp:43:3
    #4 0x57335c in main /home/jshi19/CodeCompass/CodeCompass/webserver/src/webserver.cpp:164:16
    #5 0x7fd11d5770b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16

==1460259==ABORTING

BTW, Asan reports the odr-violation error as below when I launch the CodeCompass_webserver at very beginning. I have to use "export ASAN_OPTIONS=detect_odr_violation=0" to ignore the odr-violation error every time to let the webserver start successfully.

jshi19@ub2-uefi-b01:~$  ~/CodeCompass/install_asan/bin/CodeCompass_webserver   -w /home/jshi19/CodeCompass/workspace/   -p 6251
=================================================================
==1460113==ERROR: AddressSanitizer: odr-violation (0x7f0e24b86c60):
  [1] size=22 'odb::access::object_traits_impl<cc::model::File, odb::id_pgsql>::persist_statement_name' /home/jshi19/CodeCompass/CodeCompass/BuildAsan/model/file-odb.cxx:32:3
  [2] size=22 'odb::access::object_traits_impl<cc::model::File, odb::id_pgsql>::persist_statement_name' /home/jshi19/CodeCompass/CodeCompass/BuildAsan/model/file-odb.cxx:32:3
These globals were registered at these points:
  [1]:
    #0 0x4d4ddd in __asan_register_globals /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:360:3
    #1 0x7f0e24afa86b in asan.module_ctor (/home/jshi19/CodeCompass/install_asan/lib/serviceplugin/libmetricsservice.so+0x2ce86b)

  [2]:
    #0 0x4d4ddd in __asan_register_globals /home/brian/src/final/llvm-project/compiler-rt/lib/asan/asan_globals.cpp:360:3
    #1 0x7f0e246ac18b in asan.module_ctor (/home/jshi19/CodeCompass/install_asan/lib/serviceplugin/libprojectservice.so+0x33118b)

==1460113==HINT: if you don't care about these errors you may set ASAN_OPTIONS=detect_odr_violation=0
SUMMARY: AddressSanitizer: odr-violation: global 'odb::access::object_traits_impl<cc::model::File, odb::id_pgsql>::persist_statement_name' at /home/jshi19/CodeCompass/CodeCompass/BuildAsan/model/file-odb.cxx:32:3
==1460113==ABORTING
mcserep commented 4 years ago

Hello Steven,

Thanks for your new error report, your ASAN report was useful. I could reproduce this bug and could trace it back again to some incorrect management of function pointers. Since it looks like the previous issue was not standalone, we have launched a more thorough examination on the handling of function pointers. I hope I can get back soon with an update that all related issues are resolved.

I know it is not nice solution, but meanwhile you can try to run CodeCompass_webserver in a keepalive wrapper script (basically a loop), so it gets restarted upon a crash. Since CodeCompass webserver is stateless (apart from the authentication if enabled), it works out fine.

Kind regards, Máté

shijunjing commented 4 years ago

Hello Mate, Thank you for the info. Look forward to that you could resolve the problem soon.

Thanks again! Steven

mcserep commented 3 years ago

Hello Steven,

I know that quite a lot of time has passed, but in case you're still interested, we believe the source of the issues you faced were sorted out in #499 and #502. These are merged into master now. A fresh parse of the codebase would be required, as there was also a bug related to properly analyzing function pointers during parse time.

Kind regards, Máté

shijunjing commented 3 years ago

Hi Mate, I tried your fix, it works and the CodeCompass looks much more stable on edk2 than before. Thank you very much, I really appreciate it.

mcserep commented 3 years ago

Thank your for the feedback, we are glad to hear that the fix worked and you find CodeCompass useful :)