systemd/Fix-timeout-when-stopping-Type-notify-service.patch
Frederic Crozat 1a4d9c1220 Resynced to Base:System to fix merge conflicts
- Fix-timeout-when-stopping-Type-notify-service.patch
  Make sure MAINPID is watched when it becomes known (bnc#841544)

OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=443
2013-09-24 07:59:24 +00:00

85 lines
4.4 KiB
Diff

Delivered-To: arvidjaar@gmail.com
Received: by 10.216.219.133 with SMTP id m5csp322525wep;
Fri, 20 Sep 2013 13:55:10 -0700 (PDT)
X-Received: by 10.66.171.204 with SMTP id aw12mr10856961pac.7.1379710509504;
Fri, 20 Sep 2013 13:55:09 -0700 (PDT)
Return-Path: <systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org>
Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177])
by mx.google.com with ESMTP id mj9si13683512pab.248.1969.12.31.16.00.00;
Fri, 20 Sep 2013 13:55:09 -0700 (PDT)
Received-SPF: pass (google.com: domain of systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mail=systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org
Received: from gabe.freedesktop.org (localhost [127.0.0.1])
by gabe.freedesktop.org (Postfix) with ESMTP id D7BD0E5F24
for <arvidjaar@gmail.com>; Fri, 20 Sep 2013 13:55:06 -0700 (PDT)
X-Original-To: systemd-devel@lists.freedesktop.org
Delivered-To: systemd-devel@lists.freedesktop.org
Received: from mail.jjacky.com (unknown [23.29.69.116])
by gabe.freedesktop.org (Postfix) with ESMTP id E3B2FE5DF6
for <systemd-devel@lists.freedesktop.org>;
Fri, 20 Sep 2013 13:54:34 -0700 (PDT)
Received: from arch.local (arch.tks [10.42.0.6])
by mail.jjacky.com (Postfix) with ESMTP id 2F68E18084A;
Fri, 20 Sep 2013 22:54:11 +0200 (CEST)
From: Olivier Brunel <jjk@jjacky.com>
To: systemd-devel@lists.freedesktop.org
Date: Fri, 20 Sep 2013 22:53:52 +0200
Message-Id: <1379710432-4195-1-git-send-email-jjk@jjacky.com>
X-Mailer: git-send-email 1.8.4
Subject: [systemd-devel] [PATCH] Fix timeout when stopping Type=notify
service
X-BeenThere: systemd-devel@lists.freedesktop.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: systemd Development Mailing List <systemd-devel.lists.freedesktop.org>
List-Unsubscribe: <http://lists.freedesktop.org/mailman/options/systemd-devel>,
<mailto:systemd-devel-request@lists.freedesktop.org?subject=unsubscribe>
List-Archive: <http://lists.freedesktop.org/archives/systemd-devel>
List-Post: <mailto:systemd-devel@lists.freedesktop.org>
List-Help: <mailto:systemd-devel-request@lists.freedesktop.org?subject=help>
List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/systemd-devel>,
<mailto:systemd-devel-request@lists.freedesktop.org?subject=subscribe>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org
Errors-To: systemd-devel-bounces+arvidjaar=gmail.com@lists.freedesktop.org
Since 41efeaec a call to service_unwatch_main_pid() is done from
service_set_main_pid(), which is called upon receiving message MAINPID=
This had the side effect of not watching pid anymore, and would result in a
useless timeout when stopping the service, as the unit wouldn't be identified
from the pid, so not marked stopped which would result in systemd thinking this
was a timeout.
---
I'm not exactly familiar with systemd's internals, so this might not be the
correct way to fix this, please correct me if it isn't.
src/core/service.c | 8 ++++++++
1 file changed, 8 insertions(+)
Index: systemd-207/src/core/service.c
===================================================================
--- systemd-207.orig/src/core/service.c
+++ systemd-207/src/core/service.c
@@ -3461,9 +3461,17 @@ static void service_notify_message(Unit
log_warning_unit(u->id,
"Failed to parse notification message %s", e);
else {
+ int r;
+
log_debug_unit(u->id,
"%s: got %s", u->id, e);
service_set_main_pid(s, pid);
+ r = unit_watch_pid(u, pid);
+ if (r < 0)
+ /* FIXME: we need to do something here */
+ log_warning_unit(u->id,
+ "Failed to watch PID %lu from service %s",
+ (unsigned long) pid, u->id);
}
}