-
Notifications
You must be signed in to change notification settings - Fork 163
Got stuck at Creating completion session with arguments with full cpu usage #43
Comments
This feels like a bug to me. Can you try testing on a small project and see if it still happens with neovim? Also, feel free to comment out |
@jacobdufault Actually, I tried it on my toy project https://github.com/htfy96/c10k-server with
More information could be found at autozimu/LanguageClient-neovim#181 |
Let me give more input. Dead lock may happen for trivial config like https://gist.github.com/anonymous/6e6cf05d934bd90dd27f2cd3051c84f4 One "indexer*" thread
It prepends an element to the singly-linked list: T.Next = FirstTarget;
FirstTarget = &T; Another "indexer*" thread and the "completeparse" thread
const Target *TargetRegistry::lookupTarget(const std::string &TT,
std::string &Error) {
..............
auto J = std::find_if(std::next(I), targets().end(), ArchMatch); ////////////
if (J != targets().end()) {
Error = std::string("Cannot choose between targets \"") + I->Name +
"\" and \"" + J->Name + "\"";
return nullptr;
}
return &*I;
}
Stack trace of one of spawned clang threads by current indexer threads, `
The conclusion is that CXErrorCode error_code = clang_parseTranslationUnit2FullArgv(
index->cx_index, filepath.c_str(), args.data(), (int)args.size(),
unsaved_files.data(), (unsigned)unsaved_files.size(), flags, &cx_tu);
|
Assuming |
One possible mitigation is to partially serialize indexer tasks, guaranteeing that the time different threads calling |
If on-disk storage will ever be added to cquery, multi-process poses more problems because IPC is difficult and many embedded database does not have good multi-process support. |
sg, though I think having a dedicated job queue for doing this would work faster (no need for 100ms delays). I need to re-investigate implementing a proper job system.
I'd prefer to avoid on-disk storage unless it is relatively transparent to the rest of cquery. In that case the IPC setup should not care about the actual db storage. (FWIW, there is a cache, but that is only used for startup to restore the previous state). |
Turns out that having a dedicated job/serializing these requests will really hurt index performance, as that is where most of the indexing work happens. Ideally we can fix libclang here. The advantage of using bundled clang is we can have a custom build if needed, or a non-release/stable build. One alternative instead of a true multi-process model is to run |
Uh oh!
There was an error while loading. Please reload this page.
Hi! I am using cquery with LanguageClient-Neovim. However it seems that
cquery
got stuck afterCreating completion session with arguments
, occupying half of my cores while reportingprogress
as{"indexRequestCount":0,"doIdMapCount":0,"loadPreviousIndexCount":0,"onIdMappedCount":0,"onIndexedCount":0}
.Debug logs from LanguageClient-Neovim:
I tried to debug it and found threads occupying 100% CPU were all running
std::string::_S_construct
. GDB log is attached at https://gist.github.com/htfy96/61969e3939b69f9e3320e25ad63b5794, and here isLanguageServer.log.
I was just wondering is this a bug or the expected behavior?
The text was updated successfully, but these errors were encountered: