Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 191576 - net-analyzer/ntop-3.3 doesn't stop properly
Summary: net-analyzer/ntop-3.3 doesn't stop properly
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Alin Năstac (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-07 11:12 UTC by Johan Ymerson
Modified: 2008-07-04 23:46 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Ymerson 2007-09-07 11:12:42 UTC
The ntop init script uses a pidfile in the call to start-stop-daemon, but ntop doesn't create any pidfile. Thus, it looks like ntop gets stopped, but it is still running.
Additionally, --retry 5 is not enough as ntop may take long time to shut down. I recomend --retry 30.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/ntop start
2. /etc/init.d/ntop stop
3. ps |grep ntop

Actual Results:  
Ntop should is still running.

Expected Results:  
Ntop should not be running.

Portage 2.1.2.7 (default-linux/x86/transmode, gcc-4.1.2, glibc-2.5-r4, 2.6.18-gentoo-r6 i686)
=================================================================
System uname: 2.6.18-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz
Gentoo Base System release 1.12.9
Timestamp of tree: Thu, 06 Sep 2007 10:50:01 +0000
app-shells/bash:     3.2_p15-r1
dev-lang/python:     2.4.4-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/baselayout: 1.12.9-r2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo"
CXXFLAGS="-O2 -march=i686"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distlocks metadata-transfer parallel-fetch sandbox sfperms strict"
GENTOO_MIRRORS="http://devsrv.transmode.se/portage http://devsrv.transmode.se/portage/local http://gentoo.osuosl.org/"
LINGUAS="en se"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://devsrv.transmode.se/gentoo-portage"
USE="apache2 berkdb bitmap-fonts cli cracklib crypt dbus dri firefox fortran gdbm glitz gpm hal iconv isdnlog jpeg midi mudflap ncurses nis nls nptl nptlonly nsplugin opengl openmp pam pcre pdf perl png ppds pppd python readline reflection session spl ssl subversion tcpd truetype truetype-fonts type1-fonts unicode usb x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en se" USERLAND="GNU" VIDEO_CARDS="i810 vesa fbdev"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Jukka Ruohonen 2007-11-12 09:00:43 UTC
Ntop creates a pid file, oddly enough, to /var/lib/ntop/ntop.pid. 

I could not reproduce this: the init scripts works perfectly fine here. Can you give us more information?
Comment 2 Alin Năstac (RETIRED) gentoo-dev 2007-12-13 15:21:36 UTC
In my experience, the created pidfile is /var/run/ntop.pid. Running "start-stop-daemon --stop --retry 30 --pidfile /var/run/ntop.pid" works for me.
Comment 3 Joe Stroller 2007-12-14 07:07:02 UTC
Just to add that I just emerged ntop-3.2-r3 here and see the same behaviour.  "start-stop-daemon --stop --retry 5 --signal 9 " in the /etc/init.d stop section appears to work here. 

  $ sudo cat  /var/lib/ntop/ntop.pid
  18775
  $ ps -e | grep 18775
  18775 ?        00:00:00 ntop 
Comment 4 Ivan Yosifov 2008-03-02 10:26:47 UTC
Here too the pid file is /var/run/ntop.pid and --retry 30 actually works better than --retry 5.

Portage 2.1.4.4 (default-linux/x86/2007.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.23-gentoo-r8 i686)
=================================================================
System uname: 2.6.23-gentoo-r8 i686 Intel(R) Core(TM)2 Duo CPU E8200 @ 2.66GHz
Timestamp of tree: Sat, 01 Mar 2008 16:00:01 +0000
app-shells/bash:     3.2_p17-r1
dev-java/java-config: 1.3.7, 2.1.4
dev-lang/python:     2.4.4-r6
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.2.18.1-r2
sys-devel/autoconf:  2.13, 2.61-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   1.5.26
virtual/os-headers:  2.6.23-r3
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=prescott -mtune=prescott -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=prescott -mtune=prescott -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo"
LINGUAS="en de"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/data/root/portage_tmp"
PORTDIR="/data/root/portage_tree"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acl acpi alsa berkdb bitmap-fonts bzip2 cairo caps cdr cli cracklib crypt css cups dbus dri dvd dvdr dvdread eds encode evo exif fam ffmpeg firefox flac gdbm gif gphoto2 gpm gstreamer hal iconv jpeg kde kdeenablefinal kerberos ldap libnotify mad midi mikmod mmx mmxext mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl pam pch pcre pdf perl png python qt3 qt3support quicktime readline reflection samba sdl session spell spl sse sse2 ssl ssse3 svg tcpd threads tidy tiff truetype truetype-fonts type1-fonts unicode vim-syntax vorbis win32codecs x86 xml xorg xv zlib" ALSA_CARDS="emu10k1" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev void" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en de" USERLAND="GNU" VIDEO_CARDS="nv dummy"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 5 Remy Blank 2008-03-07 11:43:00 UTC
Same problem here. Changing the path to /var/run/ntop.pid and setting the timeout  to 30 seconds works.

I had another issue, where ntop didn't work correctly. It did start, but much of the functionality didn't work at all. Setting LC_ALL=C before launching ntop fixed the problem. The same seems to have happened in Fedora, although their solution of only setting LANG=C didn't work for me:

  https://bugzilla.redhat.com/show_bug.cgi?id=219025#c113

The following patch solved all problems for me:

--- /usr/portage/net-analyzer/ntop/files/ntop-initd     2007-07-24 23:13:25.000000000 +0200
+++ ntop        2008-03-01 19:25:10.000000000 +0100
@@ -17,12 +17,13 @@
 start() {
        checkconfig || return 1
        ebegin "Starting ntop"
+       export LC_ALL=C
        start-stop-daemon --start --exec /usr/bin/ntop -- -d -L ${NTOP_OPTS}
        eend $?
 }

 stop() {
        ebegin "Stopping ntop"
-       start-stop-daemon --stop --retry 5 --pidfile /var/lib/ntop/ntop.pid
+       start-stop-daemon --stop --retry 30 --pidfile /var/run/ntop.pid
        eend $?
 }
Comment 6 Dan A. Dickey 2008-05-23 16:06:08 UTC
Any possibility of getting the fix to /etc/init.d/ntop added to an ebuild and cvs soon?
Comment 7 tzopik 2008-06-30 00:40:07 UTC
(In reply to comment #5)
> Same problem here. Changing the path to /var/run/ntop.pid and setting the
> timeout  to 30 seconds works.
> 
> I had another issue, where ntop didn't work correctly. It did start, but much
> of the functionality didn't work at all. Setting LC_ALL=C before launching ntop
> fixed the problem. The same seems to have happened in Fedora, although their
> solution of only setting LANG=C didn't work for me:
> 
>   https://bugzilla.redhat.com/show_bug.cgi?id=219025#c113
> 
> The following patch solved all problems for me:
> 
> --- /usr/portage/net-analyzer/ntop/files/ntop-initd     2007-07-24
> 23:13:25.000000000 +0200
> +++ ntop        2008-03-01 19:25:10.000000000 +0100
> @@ -17,12 +17,13 @@
>  start() {
>         checkconfig || return 1
>         ebegin "Starting ntop"
> +       export LC_ALL=C
I confirme the last line is a great fix for ntop-3.3 and should be added to /etc/init.d/ntop. this fix many issue, especially in the rrd pluguin.


after testing many [svn.ntop.org/svn/ntop/trunk/ntop] without success, i view this in ntop-dev mail list:
http://www.mail-archive.com/ntop-dev@unipi.it/msg05738.html

>         start-stop-daemon --start --exec /usr/bin/ntop -- -d -L ${NTOP_OPTS}
>         eend $?
>  }
> 
>  stop() {
>         ebegin "Stopping ntop"
> -       start-stop-daemon --stop --retry 5 --pidfile /var/lib/ntop/ntop.pid
> +       start-stop-daemon --stop --retry 30 --pidfile /var/run/ntop.pid
>         eend $?
>  }
> 

Comment 8 Alin Năstac (RETIRED) gentoo-dev 2008-07-04 23:46:08 UTC
I've became the maintainer of ntop. Reassigned its bugs to me.
Comment 9 Alin Năstac (RETIRED) gentoo-dev 2008-07-04 23:46:45 UTC
Fixed in cvs.