It's not the bug you think it is! First off, remember that the purge doesn't free everything, just up to MAX_NUM_PURGED_HOSTS (to give something of an upper bound on time used per interval). Second, the purge is a lot like Java's garbage collection - necessary to have sometimes, but not at any specific hard-real-time interval... (So, what I'm saying is that NOT running it isn't a catastrophe, except for memory usage - it won't affect the accuracy of ntop's key data)
The code for the multithreaded version is -abstracted- this:
scanIdleLoop() {
sleep(60);
purgeIdleHosts() {
updateDeviceThpt(actDevice);
if(startTime < (lastPurgeTime[actDevice]+PURGE_HOSTS_DELAY)) return;
(else) ...do the purge...
scanTimedoutTCPSessions();
}
}
The 60 (seconds) is to drive the updateDeviceThpt calculations once per minute.
And, once every 5 cycles (300s or 5m), it does the purge...
For the mono-threaded version, there is no mass purge! That's right, no calls
to purgeIdleHosts... That's fine, the meat is in freeHostInfo anyway. Oops, no
calls there either...
I think that's a bug...
Probably, the code in packetCaptureLoop() (the single threaded main loop) should
have something for purging hosts like it does for tcp sessions. Maybe with
something so that it doesn't do ALL the purges each second...
Is anyone actually running single-threaded, who can test the attached patch? I
mean it runs and seems to purge, but I only ran it a few tens of minutes...
-----Burton
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf
Of Christian Hammers
Sent: Thursday, May 02, 2002 4:19 AM
To: [EMAIL PROTECTED]
Subject: [Ntop-dev] PURGE_HOSTS_DELAY vs. SESSION_SCAN_DELAY
Hello
I found a bug where I am not sure if it's only wrong documented or if
it's not coded as intented :)
Quoting ntop.h:
> /* Timedout sessions are scanned each SESSION_SCAN_DELAY seconds */
> #define SESSION_SCAN_DELAY 60 /* 60 secs */
> #define PURGE_HOSTS_DELAY 60 /* 5 mins */
but currently scanTimedoutTCPSessions are in hash.c in the function
> void purgeIdleHosts(int actDevice) {
which has the statement
> return; /* Too short */
The original SESSION_SCAN_DELAY variable is only used in the
non-multithread version.
bye,
-christian-
--
Christian Hammers WESTEND GmbH - Aachen und Dueren Tel 0241/701333-0
[EMAIL PROTECTED] Internet & Security for Professionals Fax 0241/911879
WESTEND ist CISCO Systems Partner - Authorized Reseller
_______________________________________________
Ntop-dev mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev
BMS0066-singlethread.patch
Description: Binary data
