From 2376f425a387a796cb22cb12ca7a48871f990b89 Mon Sep 17 00:00:00 2001 From: ajwerner Date: Fri, 30 Aug 2024 16:37:41 -0400 Subject: [PATCH] linux: Handle process gone when detaching (#543) This is an attempt to handle the situation where the process has gone away and we're shutting down. I've observed the system looping attempting to move the state out of ATTACHED. It's possible that the state machine here needs to be made more complex (ALREADY_ATTACHED is misleading). Informs #478. --- src/linux/frida-helper-backend.vala | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/linux/frida-helper-backend.vala b/src/linux/frida-helper-backend.vala index 9da2152c4..ed84fc4d6 100644 --- a/src/linux/frida-helper-backend.vala +++ b/src/linux/frida-helper-backend.vala @@ -1931,6 +1931,10 @@ namespace Frida { try { yield suspend (null); close (); + } catch (Error e) { + // If the process is gone, then there's no point in retrying. + if (e is Error.PROCESS_NOT_FOUND) + attach_state = ALREADY_ATTACHED; } catch (GLib.Error e) { } }