[llvm] [lit] Explicitly unset timer to free thread stack (PR #188717)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 26 05:04:29 PDT 2026


================
@@ -126,6 +126,8 @@ def cancel(self):
         if not self.active():
             return
         self._timer.cancel()
+        # Break reference cycle so that thread stack is freed immediately.
+        self._timer = None
----------------
nikic wrote:

I tried this, but it turns out that we also call cancel() after the timeout has been reached, so this ends up causing a `AttributeError: 'NoneType' object has no attribute 'cancel'` exception. (We call cancel in executeShCmd, which apparently includes the case where the command was aborted due to a timeout.)

https://github.com/llvm/llvm-project/pull/188717


More information about the llvm-commits mailing list