From fc3d65d0b5c0273dcdd18e422fa4766e1fbd859e Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 22 Jun 2025 15:35:07 +0200 Subject: async_run_in_fork: explicitly give up on the event loop The forked process still shares file descriptors with its parent running asyncio code. Having two processes deal with the same epoll fd or similar would be really bad. Hence release the event loop in the child to prevent accidental use. --- linuxnamespaces/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/linuxnamespaces/__init__.py b/linuxnamespaces/__init__.py index 5b163df..21afd4a 100644 --- a/linuxnamespaces/__init__.py +++ b/linuxnamespaces/__init__.py @@ -106,6 +106,7 @@ class async_run_in_fork: self.efd.read() self.efd.close() self.efd = None + asyncio.set_event_loop(None) function() except: os._exit(1) -- cgit v1.2.3