we are running the cbuild using subprocesses or in containers and so, we make use of unix signals to control the tool (e.g. use of timeout, https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-termination,etc.). Nonetheless, the tool does not listen to unix signals (such as https://gobyexample.com/signals) and spawns or opens resources such as subprocesses, files, etc. If the tool process receives a SIGKILL, it will hence, most likely, leave resources in a bad state (e.g. open file, hanging subprocesses)
A solution to this would be to ensure the tool listens to signals such as SIGTERM and properly closes any open resources when such signal is received (in other words, it should close gracefully). The use of context could be leveraged.