Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix systemd watchdog feature #1525

Merged
merged 1 commit into from May 3, 2017
Merged

Fix systemd watchdog feature #1525

merged 1 commit into from May 3, 2017

Conversation

guilhem
Copy link
Contributor

@guilhem guilhem commented May 2, 2017

Commit coreos/go-systemd@0c088e introduce cleaning environment.
First usage of sdnotify (for type=notify) was clearing NOTIFY_SOCKET environment variable.
sdnotify in watchdog was unable to ping back.

Fix #1353

Copy link
Member

@emilevauge emilevauge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @guilhem ✋ !
Few comments :) But thanks for this !

if err != nil {
log.Error("Problem with watchdog", err)
} else if t != 0 {
// Send a ping each half time given
t = t / 2
log.Info("Watchdog activated with timer each ", t)
go func(interval time.Duration) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to avoid panic, could you use safe.Go to launch the go routine here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

go func(interval time.Duration) {
tick := time.Tick(interval)
for range tick {
daemon.SdNotify(true, "WATCHDOG=1")
if ok, _ := daemon.SdNotify(false, "WATCHDOG=1"); ok {
log.Debug("Tick watchdog")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we log on error instead ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed :)

Copy link
Member

@emilevauge emilevauge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @guilhem
LGTM

Commit coreos/go-systemd@0c088e introduce cleaning environment.
First usage of sdnotify (for type=notify) was clearing NOTIFY_SOCKET environment variable.
sdnotify in watchdog was unable to ping back.

Fix #1353
@ldez ldez merged commit f621d7a into traefik:master May 3, 2017
@guilhem guilhem deleted the fix-watchdog branch May 3, 2017 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug/fix a bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants