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

[dev.icinga.com #6118] reloading icinga2 doesn't work when run as a native systemd service #1515

Closed
icinga-migration opened this issue May 4, 2014 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/6118

Created by gvegidy on 2014-05-04 18:53:07 +00:00

Assignee: gvegidy
Status: Resolved (closed on 2014-05-18 16:50:03 +00:00)
Target Version: 2.0 Beta 1
Last Update: 2014-05-18 16:50:03 +00:00 (in Redmine)


systemd determines the pid of the icinga2 daemon when it starts.
When this pid later ends due to the reload succeeding, systemd declares icinga dead, even if it forked off another daemon process before.

This only is an issue when running icinga as a native systemd service, when using a classic initscript, systemd seems to allow this behavior.

Changesets

2014-05-04 20:25:44 +00:00 by gvegidy 5aa27be

First progress in making reload work with systemd.

I'm not sure about the consequences of GuessMainPID=no though.

Refs #6118

2014-05-17 21:18:18 +00:00 by gvegidy 2cd2b46

Proof of concept how a real reload-handling with systemd could work.

Refs #6118

2014-05-18 13:11:20 +00:00 by gvegidy 4705a5f

Only rewrite pidfile when reloading was successful.

Refs #6118

2014-05-18 14:23:16 +00:00 by gvegidy cd9e796

Unlink the pidfile when we really shutdown (not reload).

Refs #6118

2014-05-18 14:33:55 +00:00 by gvegidy 46740c2

Don't fork twice on daemon reload but still take care of setting up correct IO file descriptors.

Refs #6118

2014-05-18 15:26:22 +00:00 by gvegidy 92c3570

Make sure the daemon wrote it's pidfile before the forking process exits.

Refs #6118

2014-05-18 15:56:01 +00:00 by gvegidy ca22c07

Fix coding style and C-string access

Refs #6118

2014-05-18 16:04:34 +00:00 by gvegidy eec1c8c

Add Process::GetPID and make it work on Unix and Windows.

Refs #6118

2014-05-18 16:13:48 +00:00 by gvegidy 0aa6d75

Fix coding-style and use the "String"-class.

Refs #6118

2014-05-18 16:26:06 +00:00 by gvegidy da85996

Proof of concept how a real reload-handling with systemd could work.

Refs #6118

2014-05-18 16:26:14 +00:00 by gvegidy c5e3ba5

Only rewrite pidfile when reloading was successful.

Refs #6118

2014-05-18 16:26:23 +00:00 by gvegidy 1bd6af2

Unlink the pidfile when we really shutdown (not reload).

Refs #6118

2014-05-18 16:26:26 +00:00 by gvegidy 325efdd

Don't fork twice on daemon reload but still take care of setting up correct IO file descriptors.

Refs #6118

2014-05-18 16:26:29 +00:00 by gvegidy a1c6e55

Make sure the daemon wrote it's pidfile before the forking process exits.

Refs #6118

2014-05-18 16:26:31 +00:00 by gvegidy 65113fa

Fix coding style and C-string access

Refs #6118

2014-05-18 16:26:33 +00:00 by gvegidy 5eecaa3

Add Process::GetPID and make it work on Unix and Windows.

Refs #6118

2014-05-18 16:26:36 +00:00 by gvegidy 867bc40

Fix coding-style and use the "String"-class.

Refs #6118

2014-05-18 16:39:35 +00:00 by gvegidy e93a22b

Proof of concept how a real reload-handling with systemd could work.

Refs #6118

2014-05-18 16:44:54 +00:00 by gvegidy e0d4b9f

Unlink the pidfile when we really shutdown (not reload).

Refs #6118

2014-05-18 16:44:57 +00:00 by gvegidy 541de0d

Add Process::GetPID and make it work on Unix and Windows.

Refs #6118

2014-05-18 16:46:46 +00:00 by gbeutner 1e57861

Merge branch 'feature/systemd-reload-6118' into next

Fixes #6118

Parent Task: #4794

@icinga-migration
Copy link
Author

Updated by gvegidy on 2014-05-04 21:44:06 +00:00

I've contacted the systemd developers about this, see http://lists.freedesktop.org/archives/systemd-devel/2014-May/019022.html

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2014-05-12 08:22:08 +00:00

  • Target Version set to 2.0 Beta 1

@icinga-migration
Copy link
Author

Updated by gvegidy on 2014-05-17 21:25:56 +00:00

  • Done % changed from 0 to 20

Got feedback from the systemd developers and did a quick test.

To add real systemd support we need to change at least these points:

  1. on reload: write the pid of the new daemon before the old daemon exits
  2. the first task (called with --daemonize) must not exit before the pid of the real daemon is written into the pidfile

@icinga-migration
Copy link
Author

Updated by gbeutner on 2014-05-18 16:50:04 +00:00

  • Status changed from New to Resolved
  • Done % changed from 20 to 100

Applied in changeset 1e57861.

@icinga-migration icinga-migration added the enhancement New feature or request label Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.0 Beta 1 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant