From 11855b765ccd4a6586449084ce8823bcf06c487e Mon Sep 17 00:00:00 2001 From: Jeremy Fleischman Date: Fri, 22 May 2026 01:31:14 -0700 Subject: [PATCH] nixos/test-driver: null out self.pid when shutting down the container Without this, we end up with `self.pid` set to the pid of a dead process, and `self.process == None`. This causes us to blow [this assert](https://github.com/jfly/nixpkgs/blob/dd51e81af9226ee80e6f0891f4649e12ea15dfd0/nixos/lib/test-driver/src/test_driver/machine/__init__.py#L1496) in `NspawnMachine.release`. It would probably be cleaner to just get rid of `self.pid`. It's redundant given that we have `self.process`. I'll do that in a followup commit. This was discovered here: https://github.com/NixOS/nixpkgs/pull/522886#discussion_r3285395646, and will be protected against future regression by a test introduced in that PR. --- nixos/lib/test-driver/src/test_driver/machine/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/lib/test-driver/src/test_driver/machine/__init__.py b/nixos/lib/test-driver/src/test_driver/machine/__init__.py index 3dc4f1f8d171..17f19f5d3068 100644 --- a/nixos/lib/test-driver/src/test_driver/machine/__init__.py +++ b/nixos/lib/test-driver/src/test_driver/machine/__init__.py @@ -1721,6 +1721,7 @@ class NspawnMachine(BaseMachine): with self.nested("waiting for the container to power off"): self.process.wait() self.process = None + self.pid = None class MachineDeprecationWrapper: