It's not related to anything else, AFAIK.  It's something Luca and I are
aware of but really don't understand well enough to fix.

There is a mutex, hostsHashMutex (myGlobals, notch), which should prevent
pbuf from updating the data that rrd is in the middle of dumping.

If you look at my version of the log message, you'll see that different pids
(threads) are doing the unlocks:

Mar  4 10:34:14 tigger ntop[5834]: WARNING: releaseMutex() call with an
UN-LOCKED mutex [rrdPlugin.c:1258] last unlock [pid 5837, pbuf.c:2528]

(gdb) info thread
  9 Thread 57352 (LWP 5837)  0x420d3b2e in select () from
/lib/i686/libc.so.6
...
  6 Thread 32773 (LWP 5834)  0x420ae561 in nanosleep () from
/lib/i686/libc.so.6

(gdb) thread 6
[Switching to thread 6 (Thread 32773 (LWP 5834))]#0  0x420ae561 in nanosleep
()
   from /lib/i686/libc.so.6
(gdb) info stack
#0  0x420ae561 in nanosleep () from /lib/i686/libc.so.6
#1  0x4045983c in nanosleep () from /lib/i686/libpthread.so.0
#2  0x420ae481 in sleep () from /lib/i686/libc.so.6
#3  0x4011d3a9 in ntop_sleep (secs=300) at util.c:3012
#4  0x40665b09 in rrdMainLoop (notUsed=0x0) at rrdPlugin.c:1098
#5  0x40455941 in pthread_start_thread () from /lib/i686/libpthread.so.0

(gdb) thread 9
[Switching to thread 9 (Thread 57352 (LWP 5837))]#0  0x420d3b2e in select ()
   from /lib/i686/libc.so.6
(gdb) info stack
#0  0x420d3b2e in select () from /lib/i686/libc.so.6
#1  0x40152e40 in __JCR_LIST__ () from /usr/lib/libntop-2.1.58pre.so
#2  0x40455941 in pthread_start_thread () from /lib/i686/libpthread.so.0

And from the log,

Mar  3 21:49:03 tigger ntop[5837]: THREADMGMT: pcap dispatch thread
started...

5834 is the rrd thread, 5837 is the pcap capture (void* pcapDispatch(void
*_i) {})

rrd should be locking the mutex as it's dumping blocks of hosts.  We free
the mutex every so often so that we don't block pcap.  But if pcap runs
during the time rrd has the mutex, it should BLOCK.  Instead it seems to
keep running...

>From man pthread_mutex_lock:

       pthread_mutex_lock locks the given mutex. If  the  mutex  is
currently
       unlocked,  it  becomes  locked  and  owned  by  the calling thread,
and
       pthread_mutex_lock returns immediately. If the mutex is already
locked
       by another thread, pthread_mutex_lock suspends the calling thread
until
       the mutex is unlocked.

We know it's not a recursive lock (see man pthread_mutexattr_init), because
pcap would hang.  And besides that's not the default Linux behavior.


What I'm coming to think is that pcap IS sleeping, but is woken up by the
arrival of another packet.  That's going to take some proving and then some
tricky coding.  POSIX threads + Signals is a real boundary condition...



-----Burton



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
Of [EMAIL PROTECTED]
Sent: Friday, February 28, 2003 10:22 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: [Ntop-dev] RRD problems?



That appeared to have solved the problem.  Thanks.

Enclosed is a curious output that seems to be related, although not a
grievous at the previous "Errors"..  What does this indicate?  Anything I
need to worry about?

28/Feb/2003 11:06:10 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1221]
28/Feb/2003 11:06:15 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1221]
28/Feb/2003 11:06:16 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1232]
28/Feb/2003 11:07:11 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1232]
28/Feb/2003 11:08:13 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1232]
28/Feb/2003 11:09:16 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1232]
28/Feb/2003 11:10:11 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1221]
28/Feb/2003 11:10:15 WARNING: releaseMutex() call with an UN-LOCKED mutex
[pbuf.c:2528] last unlock [pid 16828, rrdPlugin.c:1232]
28/Feb/2003 11:10:16 WARNING: releaseMutex() call with an UN-LOCKED mutex
[lastSeenPlugin.c:96] last unlock [pid 16826, ntop.c:646

--

J. Eric Josephson
Director of Network and System Operations
978-720-2159
mailto:[EMAIL PROTECTED]


_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev

Reply via email to