From 9e5fbcd668709a79a876e4c6eff13b975b0f3631 Mon Sep 17 00:00:00 2001 From: unichronic Date: Sun, 18 Jan 2026 00:37:44 +0530 Subject: [PATCH] pycriu: Fix self-dump failure with explicit PID When `opts.pid` is explicitly set to `os.getpid()`, `pycriu` fails to daemonize the `criu` process. This causes `criu` to run as a child of the dumped process, leading to the error "The criu itself is within dumped tree". This can be fixed by modifying `_send_req_and_recv_resp` to check if the target PID matches the current process PID. If so, it enables daemon mode, ensuring `criu` is detached and the dump succeeds. Signed-off-by: unichronic --- lib/pycriu/criu.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pycriu/criu.py b/lib/pycriu/criu.py index 760d2be78..51a5c2902 100644 --- a/lib/pycriu/criu.py +++ b/lib/pycriu/criu.py @@ -242,7 +242,7 @@ class criu: # process resources from its own if criu is located in a same # process tree it is trying to dump. daemon = False - if req.type == rpc.DUMP and not req.opts.HasField('pid'): + if req.type == rpc.DUMP and (not req.opts.HasField('pid') or req.opts.pid == os.getpid()): daemon = True try: