Forum Discussion
iRule with table apparently leaking memory
I did find SOL12245, which details a known memory leak in the table keys -subtable command, which we use. However, it specifically states that it doesn't apply to the command when the -count option is used, which is the only way that we use it. I can't see any other reason for the memory leak, unless the expiration only applies to keys, but the subtables never expire?
TIA for any help:
when RULE_INIT {
set ::pdfappmaxRate 20 ;set later per user from class
set static::pdfappwindowSecs 300 ;global
}
when HTTP_REQUEST {
if { [HTTP::method] eq "GET" } {
Check to make sure the user is not in a redirect loop because of not accepting cookies
if { (([HTTP::uri] contains "?tag=1?tag=1") or ([HTTP::uri] contains "&tag=1&tag=1")) } {
HTTP::redirect "http://ieeepdfapp.site.com/pdfapp/cookiedetectresponse.jsp"
}
if { (([HTTP::uri] contains "stamp.jsp") or ([HTTP::uri] contains ".pdf")) and not ([HTTP::header exists Range ]) and ([HTTP::cookie exists ERIGHTS])} {
log local0. "pdfapp PDF Initial download detected."
Extract clients IP address
set client_ip [IP::remote_addr]
set pdfapp_session [HTTP::cookie ERIGHTS]
set mypdfappMaxRate $::pdfappmaxRate
set pdfnum [table incr "pdfapp:$pdfapp_session"]
set orig_ip [table lookup -subtable session_map $pdfapp_session]
log local0. "Session ID $pdfapp_session should have IP [table lookup -subtable session_map $pdfapp_session]"
log local0. "Client actually has IP $client_ip"
table lifetime pdfapp:$pdfapp_session 3600
table timeout pdfapp:$pdfapp_session 3600
log local0. "Client $client_ip has $pdfnum total hits"
set tbl "countpdf:$pdfapp_session"
table set -subtable $tbl $pdfnum "ignored" indef $static::pdfappwindowSecs
log local0. "Client $pdfapp_session has: [table keys -subtable $tbl -count] pdf downloads in the past $static::pdfappwindowSecs seconds"
if { [table keys -subtable $tbl -count] > $mypdfappMaxRate } {
log local0. "PDF Abuse - User $client_ip, Session $pdfapp_session"
HTTP::respond 200 content {"Slow Down!"
}
return
}
}
}
}
- hoolio
Cirrostratus
Hi mrintzler, - Kevin_Davies_40
Nacreous
I dont think we are seeing the whole picture here. As Aaron said $webapp_session is not defined anywhere. - mrintzler
Nimbostratus
Aaron/Jarv, - hoolio
Cirrostratus
As long as you're editing the post, can you add [ code ] [/ code ] tags (without the spaces) to preserve the spacing in the iRule? - mrintzler
Nimbostratus
Ok. I've cleaned it up a bit, I think. - spark_86682Historic F5 AccountThe SOL is accurate; if you're using the -count flag, that leak doesn't apply. The only other known issue which looks like a leak happens when you have your box configured as an HA pair, but don't have (or can't connect to) the peer. All of the records to be mirrored (including the session table) get backed up, waiting for the peer to acknowledge that they've been mirrored. If that never happens, then they never get freed. If that's not it, then you likely need to open a support case. If that is it, you might want to open a support case any way so that we can track instances of this issue (reference ID 247874).
- mrintzler
Nimbostratus
Spark,
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com