All it does is

void shutdownNtop(void) {
  printHTMLheader("ntop is shutting down...", BITFLAG_HTML_NO_REFRESH);
  closeNwSocket(&myGlobals.newSock);
  termAccessLog();
<snip/>
  cleanup(0);
}

Where cleanup() is the routine called by the signal handler.

Since the shutdown message CAN be received at any time, it's not always easy
to ensure a clean shutdown.

None of it matters - whether ntop releases it's memory cleanly or not, the
OS will reclaim it when the process ends anyway.

cleanup() does a bunch of stuff, but the only thing that really could
corrupt data is the shutdown of rrd.

RETSIGTYPE cleanup(int signo) {
...
  unloadPlugins();
...

which in turn calls the termXXXfunct for each plugin:

static void termRRDfunct(void) {
#ifdef CFG_MULTITHREADED
  if(active) killThread(&rrdThread);
#endif

#ifdef CFG_MULTITHREADED
  deleteMutex(&rrdMutex);
#endif

  traceEvent(CONST_TRACE_INFO, "RRD: Thanks for using the rrdPlugin");
  traceEvent(CONST_TRACE_ALWAYSDISPLAY, "RRD: Done");
  fflush(stdout);

  initialized = 0; /* Reinit on restart */
}

I suppose we should put a accessMutex() call in there so that it waits for
rrd to finish.

It could also be that

void killThread(pthread_t *threadId) {
  pthread_detach(*threadId);
  myGlobals.numThreads--;
}

needs to also do the POSIX pthread_kill() call.  Since some OSes really
implement the different symantics of pthread_detach() vs pthread_kill(), you
could argue it's actually REQUIRED.  But since ANY thread can receive the
kill, you can also argue that it will make things far, far worse.  That's
something to change early in a development cycle, when there's time for
fallout.

But any messages during cleanup are just cosmetics... if there's something
consistent in there, we can certainly take a look at it, especially if it's
a squencing problem (freeing item x after the pointer to it was already
freed, that kind of stuff).


-----Burton



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf
Of Markus Rehbach
Sent: Monday, September 08, 2003 12:32 AM
To: [EMAIL PROTECTED]
Subject: Re: [Ntop-dev] **ERROR** accessMutex() called 'scanIdleLoop'
with an UN-INITIALIZED mutex [EMAIL PROTECTED]:487]


The messages are there using the web interface, too.

On Monday 08 September 2003 00:02, Burton M. Strauss III wrote:
> Chill out - I frankly don't give a damn what happens when it's closing
> down. And you shouldn't either.
>
> While it's possible to patch the util.c functions to skip the messages if
> ntop is shutting down, why waste the effort - a few instructions for each
> packet vs. a couple of messages... no way Jose!
>
> If you do a controlled shutdown, via the web interface, that should be a
> clean shutdown.  But if you control-c the process - all bets are off.
>
> Please STOP reporting ANY problems after you control-c
>

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

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

Reply via email to