Subject: pkg/29323: ntop crashes out with a pthread error
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <Dave.Tyson@liverpool.ac.uk>
List: pkgsrc-bugs
Date: 02/10/2005 12:23:00
>Number:         29323
>Category:       pkg
>Synopsis:       ntop crashes out with a pthread error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 10 12:23:00 +0000 2005
>Originator:     Dave Tyson
>Release:        NetBSD 2.0
>Organization:
The University of Liverpool
>Environment:
System: NetBSD crunch.liv.ac.uk 2.0 NetBSD 2.0 (GENERIC.MP) #1: Thu Dec 9 13:51:52 GMT 2004 root@crunch.liv.ac.uk:/usr/src/sys/arch/i386/compile/GENERIC.MP i386
Architecture: i386
Machine: i386
>Description:
	ntop 3.1 installs from pkgsrc fine and starts up OK, however after a
variable length of time it crashes out with a pthread error after using a 
browser to examine the captured data. 
>How-To-Repeat:
	Start ntop on an interface. Connect with a web browser to port 3000 and
notice that after a while nmap dies:

# ifconfig wm0 up
# ntop -i wm0 
Thu Feb 10 12:45:28 2005  Initializing gdbm databases
Thu Feb 10 12:45:28 2005  ntop will be started as user nobody
Thu Feb 10 12:45:28 2005  ntop v.3.1 MT (SSL)
Thu Feb 10 12:45:28 2005  Configured on Feb 10 2005 10:44:44, built on Feb 10 2005 10:48:39.
Thu Feb 10 12:45:28 2005  Copyright 1998-2004 by Luca Deri <deri@ntop.org>
Thu Feb 10 12:45:28 2005  Get the freshest ntop from http://www.ntop.org/
Thu Feb 10 12:45:28 2005  Initializing ntop
Thu Feb 10 12:45:28 2005  Checking wm0 for additional devices
Thu Feb 10 12:45:28 2005  Resetting traffic statistics for device wm0
Thu Feb 10 12:45:28 2005  DLT: Device 0 [wm0] is 1, mtu 1514, header 14
Thu Feb 10 12:45:28 2005  Initializing gdbm databases
Thu Feb 10 12:45:29 2005  VENDOR: Loading MAC address table.
Thu Feb 10 12:45:29 2005  VENDOR: Checking for MAC address table file
Thu Feb 10 12:45:29 2005  VENDOR: File '/usr/pkg/share/ntop/ntop/specialMAC.txt.gz' does not need to be reloaded
Thu Feb 10 12:45:29 2005  VENDOR: ntop continues ok
Thu Feb 10 12:45:29 2005  VENDOR: Checking for MAC address table file
Thu Feb 10 12:45:29 2005  VENDOR: File '/usr/pkg/share/ntop/ntop/oui.txt.gz' does not need to be reloaded
Thu Feb 10 12:45:29 2005  VENDOR: ntop continues ok
Thu Feb 10 12:45:29 2005  Fingeprint: Loading signature file.
Thu Feb 10 12:45:37 2005  Fingeprint: ...loaded 1697 records
Thu Feb 10 12:45:37 2005  ASN: Checking for Autonomous System Number table file
Thu Feb 10 12:45:37 2005  **WARNING** ASN: Unable to open file 'AS-list.txt'
Thu Feb 10 12:45:37 2005  I18N: This instance of ntop does not support multiple languages
Thu Feb 10 12:45:37 2005  IP2CC: Checking for IP address <-> Country Code mapping file
Thu Feb 10 12:45:37 2005  IP2CC: Loading file '/usr/pkg/share/ntop/ntop/p2c.opt.table.gz'
Thu Feb 10 12:45:40 2005  IP2CC: ...found 52395 lines
Thu Feb 10 12:45:40 2005  GDVERCHK: Guessing at libgd version
Thu Feb 10 12:45:40 2005  GDVERCHK: ... as 2.0.21+
Thu Feb 10 12:45:40 2005  Initializing external applications
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1275068416) for network packet analyser
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1277165568) for fingerprinting
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1279262720) for idle hosts detection
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1281359872) for DNS address resolution
Thu Feb 10 12:45:40 2005  Calling plugin start functions (if any)
Thu Feb 10 12:45:40 2005  THREADMGMT: Packet processor thread running...
Thu Feb 10 12:45:40 2005  THREADMGMT: Fingerprint scan thread running...
Thu Feb 10 12:45:40 2005  THREADMGMT: Idle host scan thread running...
Thu Feb 10 12:45:40 2005  THREADMGMT: Address resolution thread running...
Thu Feb 10 12:45:40 2005  CHKVER: Checking current ntop version at version.ntop.org/version.xml
Thu Feb 10 12:45:40 2005  SSL is present but https is disabled: use -W <https port> for enabling it
Thu Feb 10 12:45:40 2005  INITWEB: Initializing web server
Thu Feb 10 12:45:40 2005  INITWEB: Initializing tcp/ip socket connections for web server
Thu Feb 10 12:45:40 2005  INITWEB: Initialized socket, port 3000, address (any)
Thu Feb 10 12:45:40 2005  INITWEB: Waiting for HTTP connections on port 3000
Thu Feb 10 12:45:40 2005  INITWEB: Starting web server
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1285554176) for web server
Thu Feb 10 12:45:40 2005  Listening on [wm0]
Thu Feb 10 12:45:40 2005  Loading Plugins
Thu Feb 10 12:45:40 2005  THREADMGMT: web connections thread (733) started...
Thu Feb 10 12:45:40 2005  Note: SIGPIPE handler set (ignore)
Thu Feb 10 12:45:40 2005  WEB: ntop's web server is now processing requests
Thu Feb 10 12:45:40 2005  Searching for plugins in /usr/pkg/lib/ntop/plugins
Thu Feb 10 12:45:40 2005  ICMP: Welcome to icmpWatchPlugin. (C) 1999-2004 by Luca Deri
Thu Feb 10 12:45:40 2005  LASTSEEN: Welcome to LastSeenWatchPlugin. (C) 1999 by Andrea Marangoni
Thu Feb 10 12:45:40 2005  CHKVER: Version file is from 'version.ntop.org'
Thu Feb 10 12:45:40 2005  CHKVER: as of date is '2004-12-01T17:00:00'
Thu Feb 10 12:45:40 2005  CHKVER: This version of ntop is the CURRENT stable version
Thu Feb 10 12:45:40 2005  NETFLOW: Welcome to NetFlow.(C) 2002-04 by Luca Deri
Thu Feb 10 12:45:40 2005  PDA: Welcome to PDAPlugin. (C) 2001-2004 by L.Deri and W.Brock
Thu Feb 10 12:45:40 2005  RRD: Welcome to rrdPlugin. (C) 2002-04 by Luca Deri.
Thu Feb 10 12:45:40 2005  SNMP: Welcome to snmpPlugin. (C) 2004 by F.Fusco and G.Giardina
Thu Feb 10 12:45:40 2005  SFLOW: Welcome to sFlow.(C) 2002-04 by Luca Deri
Thu Feb 10 12:45:40 2005  XML: Welcome to xmldump plugin. (C) 2003-2004 by Burton Strauss
Thu Feb 10 12:45:40 2005  Calling plugin start functions (if any)
Thu Feb 10 12:45:40 2005  RRD: Welcome to the RRD plugin
Thu Feb 10 12:45:40 2005  RRD: Mask for new directories is 0700
Thu Feb 10 12:45:40 2005  RRD: Mask for new files is 0066
Thu Feb 10 12:45:40 2005  RRD: Started thread (1287651328) for data collection.
Thu Feb 10 12:45:40 2005  Now running as requested user 'nobody' (32767:39)
Thu Feb 10 12:45:40 2005  THREADMGMT: rrd thread (1287651328) started
Thu Feb 10 12:45:40 2005  INIT: Created pid file (/var/ntop/ntop.pid)
Thu Feb 10 12:45:40 2005  Note: Reporting device initally set to 0 [wm0] (merged)
Thu Feb 10 12:45:40 2005  THREADMGMT: Started thread (1289748480) for network packet sniffing on wm0
Thu Feb 10 12:45:40 2005  THREADMGMT: pcapDispatch(wm0) thread running...
Thu Feb 10 12:45:49 2005  NOTE: -L | --use-syslog=facility not specified, child processes will log to the default (24).
assertion "retval == 0" failed: file "/usr/src/lib/libpthread/pthread_alarms.c", line 105, function "pthread__alarm_add"
	
>Fix:
	Sorry unknown. This problem shows up under 2.0_RELEASE as well. It
looks like this is related to calls to pthread_conv_timedwait which then 
calls pthread__alarm_add and bombs out. I don't understand this thread code :)