Bug 198736 - net-mgmt/smokeping init script fails to check pid correctly
Summary: net-mgmt/smokeping init script fails to check pid correctly
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Rodrigo Osorio
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-20 14:14 UTC by vince
Modified: 2015-06-14 09:20 UTC (History)
3 users (show)

See Also:
bugzilla: maintainer-feedback? (rodrigo)


Attachments
patch to the smokeping rc.d init file (527 bytes, patch)
2015-03-20 14:14 UTC, vince
no flags Details | Diff
patch for smokeping.in (1.79 KB, patch)
2015-05-30 01:53 UTC, Kan Sasaki
no flags Details | Diff
patch for smokeping.in (2.06 KB, patch)
2015-05-31 03:28 UTC, Kan Sasaki
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description vince 2015-03-20 14:14:15 UTC
Created attachment 154574 [details]
patch to the smokeping rc.d init file

The init script for smokeping doesn't pass the the interpreter (perl) to check_pidfile so will claim smokeping isnt running when it is.
adding $command_interpreter as the 3rd argument to check_pidfile fixes this. I have attached a patch for this

Also there should probably be a sleep 1 or something in smokeping_stop() as a restart happens too fast and tries to start it again before it dies but I'm unsure of best practices for that situation so I havent tried to patch this.
Comment 1 Rodrigo Osorio freebsd_committer 2015-03-22 00:46:38 UTC
Hi,

I tested somkeping init script in various situations,
and it never failed to find the running process.
I need more clues before any move so please can you provide
the following:

- The exact version for the OS and smokeping you are running
- The scenario in which smokeping fails

Regards
- rodrigo
Comment 2 vince 2015-03-22 22:21:17 UTC
(In reply to Rodrigo Osorio from comment #1)
Hi, 
Sorry I'm so used to the old send-pr walking me though adding environment I forgot.

root@seaurchin ~]# uname -a
FreeBSD seaurchin.namesco.net 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

[root@seaurchin ~]# service smokeping restart
smokeping not running? (check /usr/local/var/smokeping/pid).
smokeping already running?  (pid=31723).
[root@seaurchin ~]# cat /usr/local/var/smokeping/pid
31723
[root@seaurchin ~]# pkg info | grep smokeping
smokeping-2.6.11_1             Latency logging and graphing system

Also tested on 

root@parisnfsen:~ # uname -a
FreeBSD parisnfsen.namesco.net 10.1-RELEASE-p5 FreeBSD 10.1-RELEASE-p5 #0 r278901: Tue Feb 17 16:04:18 CET 2015     root@parisnfsen.namesco.net:/usr/src/sys/amd64/compile/PARISNFSEN  amd64

root@parisnfsen:~ # pkg info | grep smokeping
smokeping-2.6.11_1             Latency logging and graphing system

Initially noticed/tested with smokeping-2.6.11. Adding interpreter as per /etc/rc.subr fixes it. 
I think this is quite recent as i've been running smokeping for years on various freebsd versions, but as the fix was quite easy I didnt spend any time trying to track down when it broke.

Thanks,
Vince
Comment 3 Rodrigo Osorio freebsd_committer 2015-03-22 23:23:18 UTC
(In reply to vince from comment #2)
In a fresh 10.1 install I don't face this kind of issues,
but keep investigating. btw, any additional information
can be helpful and if I found nothing, since you request
isn't harmful, I think we can commit it.
Comment 4 vince 2015-03-23 17:25:36 UTC
(In reply to Rodrigo Osorio from comment #3)
I built a new VM to try and recreate and as you say I cant reproduceit on a vanilla build. I can only guess its because these two servers started off as 8.x and 9.x and something changed/got missed in the upgrade process. if you're happy to commit the fix that would be great, else i'll try and track down what got missed to cause this. 

Thanks,
Vince
Comment 5 buchtajz 2015-03-25 09:49:10 UTC
(In reply to Rodrigo Osorio from comment #3)

Hi, i have same problem on last 9.3-release (using binary updates)

FreeBSD monitor 9.3-RELEASE-p10 FreeBSD 9.3-RELEASE-p10 #0: Tue Feb 24 21:28:03 UTC 2015     root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64

# pkg info smokeping
smokeping-2.6.11
Name           : smokeping
Version        : 2.6.11
Installed on   : Mon Mar 23 15:10:02 CET 2015
Origin         : net-mgmt/smokeping
Architecture   : freebsd:9:x86:64


adding $command_interpreter parameter to check_pidfile rutine resolve this issue.

Regards
buchtajz
Comment 6 Rodrigo Osorio freebsd_committer 2015-04-02 22:58:16 UTC
(In reply to buchtajz from comment #5)

Hi,

Testing your patch in my jails breaks smokeping start/stop process,
in 10.1. I'm curious to know if someone else have issues with smokeping
start / stop process.

- rodrigo
Comment 7 Rodrigo Osorio freebsd_committer 2015-04-03 11:28:00 UTC
I'm not able to reproduce the issue and since your patch breaks the start/stop process I can accept it.

If you found more evidences about why halting smokeping doesn't work in you configurations I'm ready to discuss and despite my lack of time, help you.

In the meantime, I'll close this ticket.
Comment 8 allg 2015-04-06 07:32:12 UTC
Hi,
I have same problem and investigated it.

If config has multiple definition in Probes section,
(for example, FPing and FPing6) then $command_interpreter is required.
In default config, there exists FPing probe only,
$command_interpreter does not work.

(FPing probe only)
# ps axuww | grep smoke
smokeping 45734 13.8  2.5 35884 24968  -  Ss    4:03PM     0:00.01 /usr/local/bin/smokeping [FPing] (perl)
# cat /usr/local/var/smokeping/pid
45734

(FPing and FPing6 defined)
# ps axuww | grep smoke
smokeping 45794  5.5  2.4 35884 24852  -  Ss    4:05PM     0:00.02 /usr/local/bin/perl /usr/local/bin/smokeping --logfile=/var/log/smokeping.log
smokeping 45795  2.4  2.4 35884 24856  -  S     4:05PM     0:00.01 /usr/local/bin/smokeping [FPing] (perl)
# cat /usr/local/var/smokeping/pid
45794

Thanks,
Comment 9 Rodrigo Osorio freebsd_committer 2015-04-06 13:19:31 UTC
reopen for investigation as we have more evidences
Comment 10 Kan Sasaki 2015-05-30 01:53:11 UTC
Created attachment 157273 [details]
patch for smokeping.in

Hi,
I have the same problem and make a patch for the script.
Comment 11 Kan Sasaki 2015-05-31 03:28:20 UTC
Created attachment 157298 [details]
patch for smokeping.in
Comment 12 commit-hook freebsd_committer 2015-06-14 09:17:34 UTC
A commit references this bug:

Author: rodrigo
Date: Sun Jun 14 09:16:58 UTC 2015
New revision: 389609
URL: https://svnweb.freebsd.org/changeset/ports/389609

Log:
  Fix smokeping rc.d script who fails to check pid correctly

  PR:		198736
  Submitted by:	vince@unsane.co.uk

Changes:
  head/net-mgmt/smokeping/Makefile
  head/net-mgmt/smokeping/files/smokeping.in
Comment 13 Rodrigo Osorio freebsd_committer 2015-06-14 09:19:34 UTC
(In reply to Kan Sasaki from comment #11)
Sasaki, I commited the first patch, let me know if it fulfills your needs
if not please reopen the tiket.
Comment 14 Rodrigo Osorio freebsd_committer 2015-06-14 09:20:00 UTC
committed thanks, and sorry for the delay