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
518 stars 101 forks source link

crash on xerces using the 'get class collaboration diagram' when diagram is large #336

Closed steakhal closed 8 months ago

steakhal commented 5 years ago

CodeCompass crashes on Xerces when we call class collaboration diagram on a certain class from vscode.

To reproduce I attach the neccessary revision details for the related sources. I also (would) attach the corecdump for the mentioned crash, but it is about 250Mb I cant upload it here. Later on I will comment a link to it if needed. Also the call stack and the raw console output.

Later on, if I have spare time, I'll look forward to hunt this one down.

codecompass sources: remote: https://github.com/mcserep/CodeCompass.git branch and commit: cefp2019 320fa9d Update ODB generated file include for LSP service with Ericsson#323.

xerces sources: remote: https://github.com/apache/xerces-c.git branch and commit: trunk be81663b9 Remove documentation of no RTTI requirement

xerces-c/src/xercesc/sax/InputSource.hpp:62 class SAX_EXPORT InputSource : public XMemory requesting the class collaboration diagram on XMemory this from vscode

cefp@ccvm:~/xerces-c$ uname -a
Linux ccvm 4.15.0-51-generic #55-Ubuntu SMP Wed May 15 14:27:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
(gdb) bt
#0  0x00007ffff5709e97 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1  0x00007ffff570b801 in __GI_abort () at abort.c:79
#2  0x00007ffff5754897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff5881b9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3  0x00007ffff575b90a in malloc_printerr (str=str@entry=0x7ffff5883890 "double free or corruption (!prev)") at malloc.c:5350
#4  0x00007ffff5762e84 in _int_free (have_lock=0, p=0x555555f195b0, av=0x7ffff5ab6c40 <main_arena>) at malloc.c:4281
#5  0x00007ffff5762e84 in __GI___libc_free (mem=0x555555f195c0) at malloc.c:3124
#6  0x00007fffda51d159 in  () at /usr/lib/x86_64-linux-gnu/graphviz/libgvplugin_dot_layout.so.6
#7  0x00007ffff5152ee4 in gvFreeLayout () at /usr/lib/x86_64-linux-gnu/libgvc.so.6
#8  0x00007ffff788c557 in cc::util::Graph::output[abi:cxx11](cc::util::Graph::Format) const () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#9  0x00007ffff783c361 in cc::service::language::CppServiceHandler::getDiagram(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&, int) () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#10 0x00007ffff7bbb76c in cc::service::lsp::LspServiceHandler::nodeDiagram[abi:cxx11](cc::service::lsp::DiagramParams const&) ()
    at /home/cefp/codecompass/install/bin/../lib/serviceplugin/liblspservice.so
#11 0x00005555555a4d2b in cc::webserver::LspHandler::beginRequest(mg_connection*) ()
#12 0x000055555559fe96 in cc::webserver::MainRequestHandler::begin_request_handler(mg_connection*) ()
#13 0x00005555555a0d46 in cc::webserver::MainRequestHandler::operator()(mg_connection*, mg_event) ()
#14 0x00005555555a133b in cc::webserver::ThreadedMongoose::delegater(mg_connection*, mg_event) ()
#15 0x00007ffff790e6e3 in on_recv_data () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#16 0x00007ffff790fe48 in mg_ev_handler () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#17 0x00007ffff7906e3d in ns_read_from_socket () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#18 0x00007ffff7908332 in ns_server_poll () at /home/cefp/codecompass/install/bin/../lib/serviceplugin/libcppservice.so
#19 0x00005555555a138d in cc::webserver::ThreadedMongoose::serve(void*) ()
#20 0x00005555555a2c88 in void cc::webserver::ThreadedMongoose::run<void>(void*, std::function<int (mg_connection*, mg_event)>) ()
#21 0x00005555555a1ce7 in cc::webserver::ThreadedMongoose::run(std::function<int (mg_connection*, mg_event)>) ()
#22 0x00005555555915ed in main ()

raw-log:

cefp@ccvm:~/xerces-c/build$ /home/cefp/codecompass/install/bin/CodeCompass_webserver   --workspace /home/cefp/my_workspace   --database "pgsql:database=xerces;host=localhost;port=5432;user=compass"
[INFO] Mongoose web server starting on port 8080
[INFO] Search server started!
[INFO] Start serving search for index /home/cefp/my_workspace/xerces/search
Error: trouble in init_rank
    %0 98
    %0 2
    %0 3
    %0 2
    %0 9
    %0 2
    %0 13
    %0 2
    %0 6
    %0 2
    %0 12
    %0 2
    %0 7
    %0 2
    %0 10
    %0 2
    %0 14
    %0 2
    %0 6
    %0 2
    %0 11
    %0 2
    %0 9
    %0 2
    %0 4
    %0 2
    %0 3
    %0 2
    %0 6
    %0 2
    %0 5
    %0 2
    %0 4
    %0 2
    %0 3
    %0 2
    %0 24
    %0 2
    %0 28
    %0 2
    %0 26
    %0 2
    %0 51
    %0 6
    %0 90
    %0 2
    %0 13
    %0 2
    %0 9
    %0 2
    %0 13
    %0 2
    %0 21
    %0 2
    %0 16
    %0 2
    %0 2
    %0 2
    %0 7
    %0 2
    %0 23
    %0 2
    %0 33
    %0 2
    %0 25
    %0 6
    %0 2
    %0 2
    %0 2
    %0 2
    %0 22
    %0 2
    %0 5
    %0 2
    %0 50
    %0 2
    %0 21
    %0 2
    %0 20
    %0 2
    %0 49
    %0 2
    %0 31
    %0 2
    %0 18
    %0 2
    %0 17
    %0 2
    %0 9
    %0 2
    %0 46
    %0 2
    %0 15
    %0 2
    %0 3
    %0 2
    %0 8
    %0 2
    %0 27
    %0 2
    %0 7
    %0 2
    %0 54
    %0 2
    %0 6
    %0 2
    %0 30
    %0 2
    %0 5
    %0 2
    %0 19
    %0 2
    %0 5
    %0 6
    %0 91
    %0 2
    %0 15
    %0 2
    %0 16
    %0 2
    %0 48
    %0 6
    %0 38
    %0 2
    %0 38
    %0 2
    %0 37
    %0 2
    %0 19
    %0 2
    %0 47
    %0 2
    %0 32
    %0 2
    %0 35
    %0 10
    %0 49
    %0 2
    %0 45
    %0 2
    %0 24
    %0 2
    %0 25
    %0 2
    %0 34
    %0 2
    %0 10
    %0 2
    %0 29
    %0 2
    %0 3
    %0 1
    %0 2
    %0 12
    %0 6
    %0 62
    %0 2
    %0 8
    %0 2
    %0 8
    %0 2
    %0 18
    %0 2
    %0 36
    %0 2
    %0 39
    %0 10
    %0 5
    %0 2
    %0 44
    %0 2
    %0 43
    %0 2
    %0 26
    %0 2
    %0 2
    %0 2
    %0 23
    %0 2
    %0 42
    %0 2
    %0 12
    %0 2
    %0 28
    %0 2
    %0 41
    %0 2
    %0 4
    %0 2
    %0 27
    %0 10
    %0 88
    %0 2
    %0 22
    %0 2
    %0 2
    %0 2
    %0 1
    %0 1
    %0 2
    %0 2
    %0 2
    %0 2
    %0 2
    %0 1
    %0 2
    %0 2
    18240456285469857060 2
    7429869583776036547 3
    1681018407291021953 3
    18336435022036367157 3
    3829679558924402787 3
    13527950481520820667 3
    4897195797877719383 3
    13854753220322834751 3
    6030785046113148805 2
    10742049235722905963 3
    18024335213751987775 3
    6492816459319668363 2
    18402143353132288415 2
    17040526145470555004 3
    5438481123420007895 3
    12922080179572741679 3
    5178040211213534087 3
    8038446892486291309 3
    12907032300346619789 2
    5783961390301393170 2
    8470325380581690045 3
    1391676055137536866 3
    %0 2
    %0 3
    %0 2
    7158890074362201832 3
    343923732602316595 2
    3261648476212813945 2
    15889171867026132079 3
    16146355764392145917 4
    12925244415463540408 2
    17818137114139763352 3
    18352624887942426466 5
    4186750792530728374 3
    17310100998473539565 3
    12188812767209013957 2
    10773024997811858719 1
    %0 1
    %0 1
    %0 1
    12245182348721028704 2
    4351971157629498013 3
    10509030649764138132 3
    18239899674024799333 3
    6009511546956734838 3
    10413036078884689755 3
    12599172901614473785 2
    9145287218956023283 3
    16141099053300816852 2
    8975158115915509457 3
    10807006393694089390 2
    8583805906288873281 2
    5521704285202393858 3
    18143555815412390798 3
    11873792138858998287 2
    10170313069237732957 2
    17123545286527134455 1
    6448584171073158099 2
    13650145478359239793 3
    7533133029207793385 3
    11235014573921602853 3
    6908467606228553197 3
    6659681367879345346 2
    7837637674429101932 1
    16685012878874838761 2
    17045417706547200397 2
    15753389833813277903 1
    7256208857087326047 1
    3301215030641026113 2
    %0 1
    %0 2
    %0 1
    %0 2
    %0 1
    %0 2
    4122718346808116034 2
    2614178756946848275 2
    13346147461393284007 2
    13748359265748977806 3
    15953470486665122026 2
    %0 2
    %0 2
    %0 2
    12710973321143823119 3
    14594184766055467602 3
    2765952473327235136 3
    9237173907636824658 3
    2481925591341718362 3
    9386246480065637190 3
    8049029130338692170 3
    9825629183901762018 2
    %0 2
    %0 3
    %0 2
    14611180155325657222 3
    %0 2
    %0 3
    %0 2
    5892362968153480210 3
    14392865438217211244 3
    4137871508004414914 2
    10403077959587913961 1
    13387915743884842657 1
    5699161865892693104 5
    7385581624216782911 2
    8071464783088439915 3
    14793834125670588912 3
    4037637278448627593 2
    736594942277374135 1
    15895429852742307733 3
    4772024135165572837 3
    %0 3
    %0 1
    %0 3
    %0 1
    %0 2
    %0 1
    8342805424084366829 2
    2621056788231254679 1
    9187852835683441644 4
    8461648619531328776 2
    15743377269608727046 1
    17898060915167454121 3
    11087889696801058233 3
    3637411018689562204 3
    1627703725633055681 1
    8176902423846833671 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    3739583345696049719 2
    9422446706838025834 1
    %0 1
    %0 1
    %0 1
    17272226933619918986 1
    2923477826239483100 3
    2607397884791152494 3
    2889776919853991043 2
    17931386200954076764 1
    9974841636864907985 3
    2251296759883845625 3
    6591326761080300489 3
    2793832754783655635 3
    577405684488044890 3
    8338072670445934913 2
    10945687979650979562 2
    12804197044288978660 1
    17747338746392211311 3
    3327548925689204052 3
    %0 3
    %0 3
    %0 2
    16822248209139383677 2
    %0 2
    %0 2
    %0 2
    13633532622789770899 2
    18268279273420494524 3
    1125144367989050476 3
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 2
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 2
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
    %0 1
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
libpath/shortest.c:324: triangulation failed
libpath/shortest.c:192: source point not in any triangle
Error: in routesplines, Pshortestpath failed
Error: lost 9187852835683441644 16146355764392145917 edge
Error: lost 5699161865892693104 18239899674024799333 edge
Error: lost 18352624887942426466 5699161865892693104 edge
Error: lost 15889171867026132079 12245182348721028704 edge
double free or corruption (out)
Aborted (core dumped)
mcserep commented 5 years ago

Thanks for the bug report. A minor remark: I don't think it mattered that you requested the class collaboration diagram from VSCode, through LSP, as the issue is seemingly with Graphviz, producing the SVG diagram.

mcserep commented 3 years ago

Reevaluating this issue now I have found that some SVG output is now produced now in <10s for the given location:

xerces-c/src/xercesc/sax/InputSource.hpp:62 class SAX_EXPORT InputSource : public XMemory requesting the class collaboration diagram on XMemory

However the diagram is not displayed in the browser. I haven't checked whether the returned SVG is a correct diagram.

mcserep commented 8 months ago

I reevaluated this bug report now, and the class collaboration diagram for the mentioned XMemory class was produced and displayed after a few seconds on https://codecompass.net/. I consider this bug report resolved.