engtmk
Dec 27, 2007Nimbostratus
bigip1 panic: unable to alloc 4194304 bytes
I found this error in my LTM log, when I asked the support he said:
that TCL was trying to resize the ::users array (internal hash table) with an index of "time,200.35.63.129", and it crossed the 4MB boundary
so I need to know if there is a way to prevent this variable from exceeding the 4MB memory limit
below you will find the iRule that caused the error:
when RULE_INIT {
set ::maxconnect 80
set ::blocktime 120
array set ::users { }
array set ::spammers { }
}
when CLIENT_ACCEPTED {
set clientip [IP::remote_addr]
log local0. "the client ip is $clientip"
if { [matchclass [IP::remote_addr] equals $::smtp_whitelist ] } {
Accept unlimited connections from the whitelist users
return
}
set clientip [IP::remote_addr]
set now [clock second]
if { [ info exists ::spammers($clientip) ] } {
if { $::blocktime > [expr { $now - $::spammers($clientip) }] } {
the user tries to connect in the blocktime period
set ::spammers($clientip) $now
TCP::respond "550 Message Rejected - Too Much spam/r/n"
log local0. "The user tries to send while in the block period - $clientip"
drop
return
}
else {
the timeout has expired free the user from the list
unset ::spammers($clientip)
log local0. "The user has been removed from the list - $clientip"
}
}
if { [ info exists ::users(nb,$clientip)] } {
if { [expr { $now - $::users(time,$clientip) }] > $::blocktime } {
the last connection was before the timeout period
set ::users(nb,$clientip) 1
set ::users(time,$clientip) $now
return
}
else {
the connection was in the timeout
incr ::users(nb,$clientip)
set t $::users(nb,$clientip)
log local0. "the user - $clientip - has been connected $t times"
set ::users(time,$clientip) $now
if { $::users(nb,$clientip) > $::maxconnect } {
the user has exceeded the max no of connections
add him to the spam list
set ::spammers($clientip) $now
set ::users(nb,$clientip) 1
set ::users(time,$clientip) $now
TCP::respond "550 Message Rejected - Too much spam\r\n"
log local0. "this user has started spamming us $clientip "
drop
return
}
}
} else {
new client
set ::users(nb,$clientip) 1
set ::users(time,$clientip) $now
log local0. "this is user has just connected - $clientip"
}
}
Thanks for the help