Bug 221740

Summary: net-mgmt/nrpe: not starting after crash
Product: Ports & Packages Reporter: Mathieu Arnold <mat>
Component: Individual Port(s)Assignee: Niclas Zeising <zeising>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (zeising)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
v1 none

Description Mathieu Arnold freebsd_committer freebsd_triage 2017-08-23 13:05:37 UTC
Created attachment 185691 [details]
v1

When nrpe quits ungracefully, for example, if the box was rebooted, it often does not start because the pid file is still there, and the pid in it exists and the pid in it is in use by some other process.

The dubious code is in src/nrpe.c in write_pid_file() around line 1756 that could be axed.

But I think the easiest way to fix this is with the attached patch. precmd is run just before starting the daemon and after checking that it is not already running.

With this, it starts just fine, and still refuses to start if it is really already running, but starts fine if the pid file contains a pid that exists but is not nrpe.
Comment 1 commit-hook freebsd_committer freebsd_triage 2017-09-06 09:24:56 UTC
A commit references this bug:

Author: mat
Date: Wed Sep  6 09:24:11 UTC 2017
New revision: 449332
URL: https://svnweb.freebsd.org/changeset/ports/449332

Log:
  Fix not starting after crash.

  When nrpe quits ungracefully, for example, if the box was rebooted, it
  often does not start because the pid file is still there, and the pid in
  it exists and the pid in it is in use by some other process.

  The dubious code is in src/nrpe.c in write_pid_file() around line 1756
  that could be axed.

  But I think the easiest way to fix this is with the attached patch.
  precmd is run just before starting the daemon and after checking that it
  is not already running.

  With this, it starts just fine, and still refuses to start if it is
  really already running, but starts fine if the pid file contains a pid
  that exists but is not nrpe.

  PR:		221740
  Submitted by:	mat
  Approved by:	maintainer timeout
  Sponsored by:	Absolight

Changes:
  head/net-mgmt/nrpe/Makefile
  head/net-mgmt/nrpe/files/nrpe2.in
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-09-06 09:28:00 UTC
A commit references this bug:

Author: mat
Date: Wed Sep  6 09:26:51 UTC 2017
New revision: 449333
URL: https://svnweb.freebsd.org/changeset/ports/449333

Log:
  MFH: r449332

  Fix not starting after crash.

  When nrpe quits ungracefully, for example, if the box was rebooted, it
  often does not start because the pid file is still there, and the pid in
  it exists and the pid in it is in use by some other process.

  The dubious code is in src/nrpe.c in write_pid_file() around line 1756
  that could be axed.

  But I think the easiest way to fix this is with the attached patch.
  precmd is run just before starting the daemon and after checking that it
  is not already running.

  With this, it starts just fine, and still refuses to start if it is
  really already running, but starts fine if the pid file contains a pid
  that exists but is not nrpe.

  PR:		221740
  Submitted by:	mat
  Approved by:	maintainer timeout, ports-secteam blanket
  Sponsored by:	Absolight

Changes:
_U  branches/2017Q3/
  branches/2017Q3/net-mgmt/nrpe/Makefile
  branches/2017Q3/net-mgmt/nrpe/files/nrpe2.in