From: Marcel Holtmann <marcel@holtmann.org>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: BlueZ development <linux-bluetooth@vger.kernel.org>,
Johan Hedberg <johan.hedberg@gmail.com>,
Michael Biebl <mbiebl@gmail.com>
Subject: Re: [PATCH] core: fix unbound watchdog-notify for timeouts <2s
Date: Sat, 13 Sep 2014 09:54:36 -0700 [thread overview]
Message-ID: <25587ECB-CBF8-4E5C-9E86-63CACCFD1A0D@holtmann.org> (raw)
In-Reply-To: <1410614483-8462-1-git-send-email-dh.herrmann@gmail.com>
Hi David,
> If the watchdog timeout is below 2s, we end up with a timeout of 0s as
> glib event source. This causes unbound watchdog notifications. Avoid this
> by never using event-timeouts below 1s.
>
> Reported by Michael Biebl.
>
> ---
> src/main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/main.c b/src/main.c
> index e6bac6e..da0bd12 100644
> --- a/src/main.c
> +++ b/src/main.c
> @@ -596,9 +596,10 @@ int main(int argc, char *argv[])
>
> seconds = atoi(watchdog_usec) / (1000 * 1000);
> info("Watchdog timeout is %d seconds", seconds);
> + seconds = (seconds < 4) ? 1 : seconds / 2;
>
> watchdog = g_timeout_add_seconds_full(G_PRIORITY_HIGH,
> - seconds / 2,
> + seconds,
> watchdog_callback,
> NULL, NULL);
while setting WatchdogSec=1 is pretty insane interval anyway, this now also means that setting it that low will cause a race condition between systemd's watchdog killing us and we are able to be quickly enough to respond with a keep alive message.
I get the feeling that if > 2s, then we should use g_timeout_add_seconds to get the advantage of being woken up with all other timeouts in our daemon. And when it is <= 2s, then we better use a high precision g_timeout_add.
One alternative is to actually use timerfd natively here and use kernel based range timers.
Regards
Marcel
next prev parent reply other threads:[~2014-09-13 16:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-13 13:21 [PATCH] core: fix unbound watchdog-notify for timeouts <2s David Herrmann
2014-09-13 16:54 ` Marcel Holtmann [this message]
2014-09-13 19:11 ` David Herrmann
2014-09-14 17:41 ` David Herrmann
2014-09-14 17:54 ` Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25587ECB-CBF8-4E5C-9E86-63CACCFD1A0D@holtmann.org \
--to=marcel@holtmann.org \
--cc=dh.herrmann@gmail.com \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=mbiebl@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.