MaskRay / ccls

C/C++/ObjC language server supporting cross references, hierarchies, completion and semantic highlighting
Apache License 2.0
3.77k stars 259 forks source link

Crash in various places, clang9.0 #496

Closed hhaim closed 5 years ago

hhaim commented 5 years ago

First thanks for doing that, still didn't find a c++ LSP that works I'm a user of vscode+clangd 10 LSP and I'm not happy so wanted to try out ccls. I have 5 min experience with ccls so forgive me if I missed something
I didn't manage to run it as a standalone mode

vscode configuration:

   "ccls.launch.command": "/scratch/hhaim/ccls/Release/ccls",
    "ccls.cache.directory": "/scratch/hhaim/ccls_cache/",
    "ccls.highlighting.enabled.types": true,
    "ccls.highlighting.enabled.freeStandingFunctions": true,
    "ccls.highlighting.enabled.memberFunctions": true,
    "ccls.highlighting.enabled.freeStandingVariables": true,
    "ccls.highlighting.enabled.memberVariables": true,
    "ccls.highlighting.enabled.namespaces": true,
    "ccls.highlighting.enabled.macros": true,
    "ccls.highlighting.enabled.enums": true,
    "ccls.highlighting.enabled.typeAliases": true,
    "ccls.highlighting.enabled.enumConstants": true,
    "ccls.highlighting.enabled.staticMemberFunctions": true,
    "ccls.highlighting.enabled.parameters": true,
    "ccls.highlighting.enabled.templateParameters": true,
    "ccls.highlighting.enabled.staticMemberVariables": true,
    "ccls.highlighting.enabled.globalVariables": true,

vscode - log

Server CWD is /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core
ccls server connection was closed
[Error - 2:20:27 PM] Connection to server got closed. Server will not be restarted.
Restarting ccls, lazy mode off
14:20:54 ccls           initialize.cc:274 I initialize in directory /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core with uri file:///auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core
14:20:54 ccls           initialize.cc:297 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":"/scratch/hhaim/ccls_cache/","format":"binary","hierarchicalPath":false,"retainInMemory":2},"capabilities":{"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]},"foldingRangeProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}}},"clang":{"excludeArgs":[],"extraArgs":[],"pathMappings":[],"resourceDir":""},"client":{"diagnosticsRelatedInformation":true,"hierarchicalDocumentSymbolSupport":true,"linkSupport":true,"snippetSupport":false},"codeLens":{"localVariables":false},"completion":{"caseSensitivity":2,"detailedLabel":false,"dropOldRequests":true,"duplicateOptional":false,"filterAndSort":true,"include":{"blacklist":[],"maxPathSize":37,"suffixWhitelist":[".h",".hpp",".hh",".inc",".h",".hpp",".hh"],"whitelist":[]},"maxNum":100},"diagnostics":{"blacklist":[],"onChange":1000,"onOpen":0,"onSave":0,"spellChecking":true,"whitelist":[]},"highlight":{"largeFileSize":2097152,"lsRanges":true,"blacklist":[],"whitelist":[]},"index":{"blacklist":[],"comments":2,"initialNoLinkage":false,"initialBlacklist":[],"initialWhitelist":[],"maxInitializerLines":15,"multiVersion":0,"multiVersionBlacklist":[],"multiVersionWhitelist":[],"name":{"suppressUnwrittenScope":false},"onChange":false,"parametersInDeclarations":true,"threads":0,"trackDependency":2,"whitelist":[]},"request":{"timeout":5000},"session":{"maxNum":10},"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"maxNum":2000}}
14:20:54 ccls           initialize.cc:326 I use -resource-dir=/scratch/hhaim/llvm8/llvm/build/lib/clang/8.0.1
14:20:54 ccls           initialize.cc:359 I workspace folder: /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/
14:20:54 ccls           initialize.cc:359 I workspace folder: /auto/srg-sce-swinfra-usr/emb/users/hhaim/_private/_doc/readme/
14:20:54 ccls              project.cc:438 I loaded /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/compile_commands.json
14:20:54 ccls           initialize.cc:384 I start 24 indexers
14:20:54 ccls           initialize.cc:392 I dispatch initial index requests
14:20:54 indexer5         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/drivers/net/i40e/base/i40e_nvm.c
14:20:54 indexer3         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/44bsd/tcp_socket.cpp
14:20:54 indexer1         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/hdrh/hdr_histogram_log.c
14:20:54 indexer7         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/stx/stl/trex_stl_port.cpp
14:20:54 indexer12        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/drivers/net/e1000/base/e1000_mac.c
14:20:54 indexer16        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/external_libs/libmnl/src/attr.c
14:20:54 indexer4         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/drivers/net/mlx5/mlx5_flow_verbs.c
14:20:54 indexer15        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/drivers/net/mlx5/mlx5_txq.c
14:20:54 indexer14        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/stx/common/trex_messaging.cpp
14:20:54 indexer13        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/drivers/net/e1000/base/e1000_nvm.c
14:20:54 indexer17        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/lib/librte_eal/linux/eal/eal_hugepage_info.c
14:20:54 indexer8         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/lib/librte_eal/common/eal_common_thread.c
14:20:54 indexer0         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/external_libs/bpf/grammar.c
14:20:54 indexer6         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/44bsd/tcp_debug.cpp
14:20:54 indexer2         pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/publisher/trex_publisher.cpp
14:20:54 indexer10        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/lib/librte_gso/gso_tunnel_tcp4.c
14:20:54 indexer20        pipeline.cc:351 I parse /auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/src/dpdk/lib/librte_ethdev/ethdev_private.c
/scratch/hhaim/ccls/Release/ccls[0x12e450f]
/scratch/hhaim/ccls/Release/ccls[0x12e2b72]
/scratch/hhaim/ccls/Release/ccls[0x12e4931]
/lib64/libpthread.so.0(+0xf5d0)[0x7f3344dbd5d0]
/scratch/hhaim/ccls/Release/ccls[0x40e8f2]
/scratch/hhaim/ccls/Release/ccls[0x5cd159]
/scratch/hhaim/ccls/Release/ccls[0x5bbd99]
/scratch/hhaim/ccls/Release/ccls[0x42017c]
/scratch/hhaim/ccls/Release/ccls[0x445d34]
/scratch/hhaim/ccls/Release/ccls[0x444504]
/scratch/hhaim/ccls/Release/ccls[0x4eaa37]
/lib64/libpthread.so.0(+0x7dd5)[0x7f3344db5dd5]
/lib64/libc.so.6(clone+0x6d)[0x7f3344241ead]
ccls server connection was closed
[Error - 2:20:54 PM] Connection to server got closed. Server will not be restarted.
  {
    "directory": "/auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/linux_dpdk/build_dpdk",
    "command": "/usr/local/gcc-6.2/bin/gcc -DWIN_UCODE_SIM -D_BYTE_ORDER -D_LITTLE_ENDIAN -DLINUX -g -Wno-format -Wno-deprecated-declarations -Wno-error=uninitialized -DRTE_DPDK -D__STDC_LIMIT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS -march=corei7 -DUCS_210 -mtune=generic -DRTE_MACHINE_CPUFLAG_SSE -DRTE_COMPILE_TIME_CPUFLAGS=RTE_CPUFLAG_SSE -DTREX_USE_BPFJIT -m64 -O3 -DNDEBUG -DTAP_MAX_QUEUES=16 -D_GNU_SOURCE -DPF_DRIVER -DX722_SUPPORT -DX722_A0_SUPPORT -DVF_DRIVER -DINTEGRATED_VF -include ../src/pal/linux_dpdk/dpdk1905_x86_64/rte_config.h -Isrc/dpdk/lib/librte_eal/common/include/arch/x86 -I../../src/dpdk/lib/librte_eal/common/include/arch/x86 -Isrc -I../../src -Isrc/pal/linux_dpdk -I../../src/pal/linux_dpdk -Isrc/pal/linux_dpdk/dpdk1905_x86_64 -I../../src/pal/linux_dpdk/dpdk1905_x86_64 -Isrc/dpdk/drivers -I../../src/dpdk/drivers -Isrc/dpdk/drivers/net -I../../src/dpdk/drivers/net -Isrc/dpdk/drivers/net/af_packet -I../../src/dpdk/drivers/net/af_packet -Isrc/dpdk/drivers/net/tap -I../../src/dpdk/drivers/net/tap -Isrc/dpdk/drivers/net/failsafe -I../../src/dpdk/drivers/net/failsafe -Isrc/dpdk/drivers/net/vdev_netvsc -I../../src/dpdk/drivers/net/vdev_netvsc -Isrc/dpdk/drivers/net/e1000 -I../../src/dpdk/drivers/net/e1000 -Isrc/dpdk/drivers/net/e1000/base -I../../src/dpdk/drivers/net/e1000/base -Isrc/dpdk/drivers/net/enic -I../../src/dpdk/drivers/net/enic -Isrc/dpdk/drivers/net/enic/base -I../../src/dpdk/drivers/net/enic/base -Isrc/dpdk/drivers/net/i40e -I../../src/dpdk/drivers/net/i40e -Isrc/dpdk/drivers/net/i40e/base -I../../src/dpdk/drivers/net/i40e/base -Isrc/dpdk/drivers/net/ixgbe -I../../src/dpdk/drivers/net/ixgbe -Isrc/dpdk/drivers/net/ixgbe/base -I../../src/dpdk/drivers/net/ixgbe/base -Isrc/dpdk/drivers/net/mlx4 -I../../src/dpdk/drivers/net/mlx4 -Isrc/dpdk/drivers/net/mlx5 -I../../src/dpdk/drivers/net/mlx5 -Isrc/dpdk/drivers/net/ntacc -I../../src/dpdk/drivers/net/ntacc -Isrc/dpdk/drivers/net/virtio -I../../src/dpdk/drivers/net/virtio -Isrc/dpdk/drivers/net/virtio/virtio_user -I../../src/dpdk/drivers/net/virtio/virtio_user -Isrc/dpdk/drivers/net/vmxnet3 -I../../src/dpdk/drivers/net/vmxnet3 -Isrc/dpdk/drivers/net/vmxnet3/base -I../../src/dpdk/drivers/net/vmxnet3/base -Isrc/dpdk/drivers/net/ena -I../../src/dpdk/drivers/net/ena -Isrc/dpdk/drivers/net/ena/base -I../../src/dpdk/drivers/net/ena/base -Isrc/dpdk/drivers/net/ena/base/ena_defs -I../../src/dpdk/drivers/net/ena/base/ena_defs -Isrc/dpdk/lib -I../../src/dpdk/lib -Isrc/dpdk/lib/librte_cfgfile -I../../src/dpdk/lib/librte_cfgfile -Isrc/dpdk/lib/librte_compat -I../../src/dpdk/lib/librte_compat -Isrc/dpdk/lib/librte_eal -I../../src/dpdk/lib/librte_eal -Isrc/dpdk/lib/librte_eal/common -I../../src/dpdk/lib/librte_eal/common -Isrc/dpdk/lib/librte_eal/common/include -I../../src/dpdk/lib/librte_eal/common/include -Isrc/dpdk/lib/librte_eal/common/include/arch -I../../src/dpdk/lib/librte_eal/common/include/arch -Isrc/dpdk/lib/librte_eal/common/include/generic -I../../src/dpdk/lib/librte_eal/common/include/generic -Isrc/dpdk/lib/librte_eal/linux -I../../src/dpdk/lib/librte_eal/linux -Isrc/dpdk/lib/librte_eal/linux/eal -I../../src/dpdk/lib/librte_eal/linux/eal -Isrc/dpdk/lib/librte_eal/linux/eal/include -I../../src/dpdk/lib/librte_eal/linux/eal/include -Isrc/dpdk/lib/librte_eal/linux/eal/include/exec-env -I../../src/dpdk/lib/librte_eal/linux/eal/include/exec-env -Isrc/dpdk/lib/librte_ethdev -I../../src/dpdk/lib/librte_ethdev -Isrc/dpdk/lib/librte_hash -I../../src/dpdk/lib/librte_hash -Isrc/dpdk/lib/librte_gso -I../../src/dpdk/lib/librte_gso -Isrc/dpdk/lib/librte_kvargs -I../../src/dpdk/lib/librte_kvargs -Isrc/dpdk/lib/librte_mbuf -I../../src/dpdk/lib/librte_mbuf -Isrc/dpdk/lib/librte_mempool -I../../src/dpdk/lib/librte_mempool -Isrc/dpdk/lib/librte_meter -I../../src/dpdk/lib/librte_meter -Isrc/dpdk/lib/librte_net -I../../src/dpdk/lib/librte_net -Isrc/dpdk/lib/librte_pci -I../../src/dpdk/lib/librte_pci -Isrc/dpdk/lib/librte_port -I../../src/dpdk/lib/librte_port -Isrc/dpdk/lib/librte_ring -I../../src/dpdk/lib/librte_ring -Isrc/dpdk/lib/librte_timer -I../../src/dpdk/lib/librte_timer -Isrc/dpdk -I../../src/dpdk -Isrc/dpdk/drivers/bus/pci -I../../src/dpdk/drivers/bus/pci -Isrc/dpdk/drivers/bus/vdev -I../../src/dpdk/drivers/bus/vdev -Isrc/dpdk/drivers/bus/pci/linux -I../../src/dpdk/drivers/bus/pci/linux -Iexternal_libs/dpdk_linux_tap_cross -I../../external_libs/dpdk_linux_tap_cross ../../src/dpdk/drivers/net/i40e/base/i40e_nvm.c -c -o/auto/srg-sce-swinfra-usr/emb/users/hhaim/work/depot/asr1k/emb/private/hhaim/bp_sim_git/trex-core/linux_dpdk/build_dpdk/src/dpdk/drivers/net/i40e/base/i40e_nvm.c.24.o",
    "file": "../../src/dpdk/drivers/net/i40e/base/i40e_nvm.c"
  },

project can be found here https://github.com/cisco-system-traffic-generator/trex-core

(https://github.com/MaskRay/ccls/wiki/Project-Setup))

 clang++ --version
clang version 8.0.1 (https://github.com/llvm-mirror/clang.git 2e4c9c5fc864c2c432e4c262a67c42d824b265c6) (https://github.com/llvm-mirror/llvm.git ea28a67e47fd87c6b78597d90eba543bad4d7468)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /scratch/hhaim/llvm8/llvm/build/bin
Compiled clang and ccls with clang 8.0.1 compiler 
cmake -G 'Unix Makefiles' -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo ..```

```cmake -G 'Unix Makefiles' -H. -BRelease -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/scratch/hhaim/llvm8_lib/llvm8/llvm -DCMAKE_INSTALL_PREFIX=/scratch/hhaim/ -DCMAKE_CXX_FLAGS='--gcc-toolchain=/scratch/hhaim/gcc-7.4/ -D_GLIBCXX_USE_CXX11_ABI=0'```

* OS: 

CentOS Linux release 7.6.1810 (Core)


* Editor: 

vscode latest

* Language client (and version): 
``` vscode
hhaim commented 5 years ago

The issue happen even with this example:

#include <stdio.h>

class A {
    public:

        int a;
        int b;
};

int main(){
    A* a= new A();
    a->b =12;
    printf(" hello %d %d \n",a->a,a->b);
    return (0);
}
Server CWD is /scratch/hhaim/cpp_test
14:42:38 ccls           initialize.cc:274 I initialize in directory /scratch/hhaim/cpp_test with uri file:///scratch/hhaim/cpp_test
14:42:38 ccls           initialize.cc:297 I initializationOptions: {"compilationDatabaseCommand":"","compilationDatabaseDirectory":"","cache":{"directory":"/scratch/hhaim/ccls_cache/","format":"binary","hierarchicalPath":false,"retainInMemory":2},"capabilities":{"documentOnTypeFormattingProvider":{"firstTriggerCharacter":"}","moreTriggerCharacter":[]},"foldingRangeProvider":true,"workspace":{"workspaceFolders":{"supported":true,"changeNotifications":true}}},"clang":{"excludeArgs":[],"extraArgs":[],"pathMappings":[],"resourceDir":""},"client":{"diagnosticsRelatedInformation":true,"hierarchicalDocumentSymbolSupport":true,"linkSupport":true,"snippetSupport":false},"codeLens":{"localVariables":false},"completion":{"caseSensitivity":2,"detailedLabel":false,"dropOldRequests":true,"duplicateOptional":false,"filterAndSort":true,"include":{"blacklist":[],"maxPathSize":37,"suffixWhitelist":[".h",".hpp",".hh",".inc",".h",".hpp",".hh"],"whitelist":[]},"maxNum":100},"diagnostics":{"blacklist":[],"onChange":1000,"onOpen":0,"onSave":0,"spellChecking":true,"whitelist":[]},"highlight":{"largeFileSize":2097152,"lsRanges":true,"blacklist":[],"whitelist":[]},"index":{"blacklist":[],"comments":2,"initialNoLinkage":false,"initialBlacklist":[],"initialWhitelist":[],"maxInitializerLines":15,"multiVersion":0,"multiVersionBlacklist":[],"multiVersionWhitelist":[],"name":{"suppressUnwrittenScope":false},"onChange":false,"parametersInDeclarations":true,"threads":0,"trackDependency":2,"whitelist":[]},"request":{"timeout":5000},"session":{"maxNum":10},"workspaceSymbol":{"caseSensitivity":1,"maxNum":1000,"sort":true},"xref":{"maxNum":2000}}
14:42:38 ccls           initialize.cc:326 I use -resource-dir=/scratch/hhaim/llvm8/llvm/build/lib/clang/8.0.1
14:42:38 ccls           initialize.cc:359 I workspace folder: /scratch/hhaim/cpp_test/
14:42:38 ccls           initialize.cc:384 I start 24 indexers
14:42:38 ccls           initialize.cc:392 I dispatch initial index requests
14:42:38 ccls             pipeline.cc:485 I loaded project. Refresh semantic highlight for all working file.
14:42:38 indexer0         pipeline.cc:351 I parse /scratch/hhaim/cpp_test/main.cpp
14:42:38 preamble     sema_manager.cc:744 I create session for /scratch/hhaim/cpp_test/main.cpp
*** Error in `/scratch/hhaim/ccls/Release/ccls': free(): invalid pointer: 0x00007fa290004bec ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81489)[0x7fa2a5248489]
/scratch/hhaim/ccls/Release/ccls[0x40e9f8]
/scratch/hhaim/ccls/Release/ccls[0x5cd159]
/scratch/hhaim/ccls/Release/ccls[0x5bbd99]
/scratch/hhaim/ccls/Release/ccls[0x42017c]
/scratch/hhaim/ccls/Release/ccls[0x445d34]
/scratch/hhaim/ccls/Release/ccls[0x444504]
/scratch/hhaim/ccls/Release/ccls[0x4eaa37]
/lib64/libpthread.so.0(+0x7dd5)[0x7fa2a5e38dd5]
/lib64/libc.so.6(clone+0x6d)[0x7fa2a52c4ead]
======= Memory map: ========
/scratch/hhaim/ccls/Release/ccls[0x12e450f]
/scratch/hhaim/ccls/Release/ccls[0x12e2b72]
/scratch/hhaim/ccls/Release/ccls[0x12e4931]
/lib64/libpthread.so.0(+0xf5d0)[0x7fa2a5e405d0]
/scratch/hhaim/ccls/Release/ccls[0x40e8f2]
/scratch/hhaim/ccls/Release/ccls[0x5cd159]
/scratch/hhaim/ccls/Release/ccls[0x5bbd99]
/scratch/hhaim/ccls/Release/ccls[0x6367f0]
/scratch/hhaim/ccls/Release/ccls[0x48716c]
/lib64/libpthread.so.0(+0x7dd5)[0x7fa2a5e38dd5]
00400000-01823000 r-xp 00000000 fd:00 301702581                          /scratch/hhaim/ccls/Release/ccls
01a23000-01b18000 r--p 01423000 fd:00 301702581                          /scratch/hhaim/ccls/Release/ccls
01b18000-01b1f000 rw-p 01518000 fd:00 301702581                          /scratch/hhaim/ccls/Release/ccls
01b1f000-01b27000 rw-p 00000000 00:00 0 
033f6000-03428000 rw-p 00000000 00:00 0                                  [heap]
7fa224000000-7fa224021000 rw-p 00000000 00:00 0 
7fa224021000-7fa228000000 ---p 00000000 00:00 0 
7fa22c000000-7fa22c021000 rw-p 00000000 00:00 0 
7fa22c021000-7fa230000000 ---p 00000000 00:00 0 
7fa230000000-7fa230021000 rw-p 00000000 00:00 0 
7fa230021000-7fa234000000 ---p 00000000 00:00 0 
7fa234000000-7fa234021000 rw-p 00000000 00:00 0 
7fa234021000-7fa238000000 ---p 00000000 00:00 0 
7fa238000000-7fa238021000 rw-p 00000000 00:00 0 
7fa238021000-7fa23c000000 ---p 00000000 00:00 0 
7fa23c000000-7fa23c021000 rw-p 00000000 00:00 0 
7fa23c021000-7fa240000000 ---p 00000000 00:00 0 
7fa240000000-7fa240021000 rw-p 00000000 00:00 0 
7fa240021000-7fa244000000 ---p 00000000 00:00 0 
7fa244000000-7fa244021000 rw-p 00000000 00:00 0 
7fa244021000-7fa248000000 ---p 00000000 00:00 0 
7fa248000000-7fa248021000 rw-p 00000000 00:00 0 
7fa248021000-7fa24c000000 ---p 00000000 00:00 0 
7fa24c000000-7fa24c021000 rw-p 00000000 00:00 0 
7fa24c021000-7fa250000000 ---p 00000000 00:00 0 
7fa250000000-7fa250021000 rw-p 00000000 00:00 0 
7fa250021000-7fa254000000 ---p 00000000 00:00 0 
7fa254000000-7fa254021000 rw-p 00000000 00:00 0 
7fa254021000-7fa258000000 ---p 00000000 00:00 0 
7fa258000000-7fa258021000 rw-p 00000000 00:00 0 
7fa258021000-7fa25c000000 ---p 00000000 00:00 0 
7fa25c000000-7fa25c021000 rw-p 00000000 00:00 0 
7fa25c021000-7fa260000000 ---p 00000000 00:00 0 
7fa260000000-7fa260021000 rw-p 00000000 00:00 0 
7fa260021000-7fa264000000 ---p 00000000 00:00 0 
7fa264000000-7fa264021000 rw-p 00000000 00:00 0 
7fa264021000-7fa268000000 ---p 00000000 00:00 0 
7fa2697fb000-7fa2697fc000 ---p 00000000 0/lib64/libc.so.6(clone+0x6d)[0x7fa2a52c4ead]
0:00 0 
7fa2697fc000-7fa269ffc000 rw-p 00000000 00:00 0                          [stack:1715]
7fa269ffc000-7fa269ffd000 ---p 00000000 00:00 0 
7fa269ffd000-7fa26a7fd000 rw-p 00000000 00:00 0                          [stack:1714]
7fa26a7fd000-7fa26a7fe000 ---p 00000000 00:00 0 
7fa26a7fe000-7fa26affe000 rw-p 00000000 00:00 0                          [stack:1713]
7fa26affe000-7fa26afff000 ---p 00000000 00:00 0 
7fa26afff000-7fa26b7ff000 rw-p 00000000 00:00 0                          [stack:1712]
7fa26b7ff000-7fa26b800000 ---p 00000000 00:00 0 
7fa26b800000-7fa26c000000 rw-p 00000000 00:00 0                          [stack:1704]
7fa26c000000-7fa26c021000 rw-p 00000000 00:00 0 
7fa26c021000-7fa270000000 ---p 00000000 00:00 0 
7fa2707f9000-7fa2707fa000 ---p 00000000 00:00 0 
7fa2707fa000-7fa270ffa000 rw-p 00000000 00:00 0                          [stack:1711]
7fa270ffa000-7fa270ffb000 ---p 00000000 00:00 0 
7fa270ffb000-7fa2717fb000 rw-p 00000000 00:00 0                          [stack:1710]
7fa2717fb000-7fa2717fc000 ---p 00000000 00:00 0 
7fa2717fc000-7fa271ffc000 rw-p 00000000 00:00 0                          [stack:1709]
7fa271ffc000-7fa271ffd000 ---p 00000000 00:00 0 
7fa271ffd000-7fa2727fd000 rw-p 00000000 00:00 0                          [stack:1708]
7fa2727fd000-7fa2727fe000 ---p 00000000 00:00 0 
7fa2727fe000-7fa272ffe000 rw-p 00000000 00:00 0                          [stack:1707]
7fa272ffe000-7fa272fff000 ---p 00000000 00:00 0 
7fa272fff000-7fa2737ff000 rw-p 00000000 00:00 0                          [stack:1706]
7fa2737ff000-7fa273800000 ---p 00000000 00:00 0 
7fa273800000-7fa274000000 rw-p 00000000 00:00 0                          [stack:1705]
7fa274000000-7fa274021000 rw-p 00000000 00:00 0 
7fa274021000-7fa278000000 ---p 00000000 00:00 0 
7fa278000000-7fa278021000 rw-p 00000000 00:00 0 
7fa278021000-7fa27c000000 ---p 00000000 00:00 0 
7fa27c000000-7fa27c021000 rw-p 00000000 00:00 0 
7fa27c021000-7fa280000000 ---p 00000000 00:00 0 
7fa280000000-7fa280021000 rw-p 00000000 00:00 0 
7fa280021000-7fa284000000 --ccls error (count undefined): undefined
ccls error (count undefined): undefined
ccls server connection was closed
[Error - 2:42:38 PM] Connection to server got closed. Server will not be restarted.
hhaim commented 5 years ago

Moving to clang 8.0.1 does not solve the issue. I'm doing something wrong

hhaim commented 5 years ago

this crash too

./ccls --version
ccls version 0.20190823-0-gd417597a
clang version 8.0.1 (https://github.com/llvm-mirror/clang.git 2e4c9c5fc864c2c432e4c262a67c42d824b265c6) (https://github.com/llvm-mirror/llvm.git ea28a67e47fd87c6b78597d90eba543bad4d7468)
hhaim commented 5 years ago

The server has many threads. 80% is about 24 threads. Limiting it to one thread like this solves the problem

exec "/scratch/hhaim/ccls/Debug/ccls" "$@" -init='{"index": {"threads": 1}}'

Now I need to go back to llvm 90 to retest

MaskRay commented 5 years ago

Error in `/scratch/hhaim/ccls/Release/ccls': free(): invalid pointer: 0x00007fa290004bec

It is hard to tell what goes wrong with a Release build. Please try https://github.com/MaskRay/ccls/wiki/Debugging

hhaim commented 5 years ago

@MaskRay thanks, I found the issue, it was my fault. ccls is brilliant, works much better than clangd 10, not sure why, if both are using the same clag index parser ??

The issue:

I enabled it in standalone mode and crashed so it was easier to debug

gdb --args ccls -index=/trex-core/ -v=1
bt

The crash pointed to clang library. It means something was wrong with my build. then I found this in your script (make -j 20 VERBOSE=1)

if(NOT CLANG_RESOURCE_DIR)
  find_program(CLANG_EXECUTABLE clang)
  if(NOT CLANG_EXECUTABLE)
    message(FATAL_ERROR "clang executable not found.")
  endif()

The clang path was different than the library location that I've build (I have many clang on this machine)

fixing this solve the issue.

-DCLANG_RESOURCE_DIR=[your llvm dir]

MaskRay commented 5 years ago

I'm glad that you've figured out the issue.

The clang path was different than the library location that I've build (I have many clang on this machine)

-DCLANG_RESOURCE_DIR=[your llvm dir] couldn't be responsible for the crash - they are just ordinary header files. It is recommended to use clang with the matching resource directory but it usually does not matter much if the versions mismatch.

My intuition is that you had mismatched clang/llvm header files and clang/llvm libraries. The libLLVM*.a or libclang*.a were not from the same build, or the libraries were not built with the set of header files you used to build ccls. clang/llvm does not maintain a stable C++ ABI.

hhaim commented 5 years ago

This is exactly what I had in mind. I did another change. I’ve compiled it with gcc 7.4 (both clang and CVLA) instead of a private clang++ compiler. Maybe the header was taken from the compiler (clang) instead of the lib private brach.