From c9d44b84fef800f5edb6225b1dd20420b38d4037 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 30 Apr 2024 20:20:43 +0000 Subject: [PATCH] Don't reject "ctl.stop.*" during shutdown. We're shutting down anyway, so the service is either dead already or about to be killed, and callers get upset (and don't have a good response themselves) if we reject the request. This was seen by a partner where adbd was asked to stop during shutdown. Bug: https://issuetracker.google.com/336223505 Change-Id: If09feeef2e0f2d1be9ff84a88cca6ed593a35362 --- init/property_service.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/init/property_service.cpp b/init/property_service.cpp index 5a1b63b2e..d02ca1e49 100644 --- a/init/property_service.cpp +++ b/init/property_service.cpp @@ -453,6 +453,10 @@ static uint32_t SendControlMessage(const std::string& msg, const std::string& na SocketConnection* socket, std::string* error) { auto lock = std::lock_guard{accept_messages_lock}; if (!accept_messages) { + // If we're already shutting down and you're asking us to stop something, + // just say we did (https://issuetracker.google.com/336223505). + if (msg == "stop") return PROP_SUCCESS; + *error = "Received control message after shutdown, ignoring"; return PROP_ERROR_HANDLE_CONTROL_MESSAGE; }