clangd does not correctly exit on SIGTERM and SIGINT in most situations
Closed this issue · 2 comments
andrey-malets commented
The cause is the following:
- Upon receiving a signal, the main thread is joining all the worker threads it has created.
- File cache has "Cache Resetter Worker" (https://github.com/abyss7/dist-clang/blob/master/src/cache/file_cache.cc#L108), which uses simple thread sleeps without any synchronisation (https://github.com/abyss7/dist-clang/blob/master/src/cache/file_cache.cc#L104).
- By default, if not overriden in config, sleep duration for this resetter thread is 600 seconds (https://github.com/abyss7/dist-clang/blob/master/src/daemon/configuration.proto#L31).
- As a result,
clangd
only exits 10 minutes after receiving termination signal.supervisorctl
and other process management tools usually only wait a few seconds before sendingSIGKILL
, thusclangd
always gets killed by this signal and does not exit gracefully.
andrey-malets commented
andrey-malets commented
Fixed in #59