Bug 8127 - Geo::IP leaking fds on spamd restart
Summary: Geo::IP leaking fds on spamd restart
Status: NEW
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: SVN Trunk (Latest Devel Version)
Hardware: All All
: P2 normal
Target Milestone: Future
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-10 18:09 UTC by Henrik Krohns
Modified: 2023-08-04 14:57 UTC (History)
2 users (show)



Attachment Type Modified Status Actions Submitter/CLA Status

Note You need to log in before you can comment on or make changes to this bug.
Description Henrik Krohns 2023-05-10 18:09:23 UTC
Copied from Bug 8090

(In reply to Henrik Krohns from comment #10)
> (In reply to Paul from comment #9)
> > Keeping the DB file open also affects Linux systems using geoip. When a
> > reload using SIGHUP is requested a 2nd path is opened without closing the
> > original path. This eventually leads to spamd stopping when it5 hits open
> > files limit of 1024
> 
> Please provide proof and exact configuration where this happens? Afaik spamd
> starts with a completely new process after HUP, it's not even possible to
> have any old open files.

spamd configured to have 5 children. 

root@kanuka:/home/paule# lsof | grep spamd | grep GeoIP.dat | grep root
spamd      766010                            root    9r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
root@kanuka:/home/paule# /etc/init.d/spamassassin reload 
Reloading spamassassin configuration (via systemctl): spamassassin.service.
root@kanuka:/home/paule# lsof | grep spamd | grep GeoIP.dat | grep root
spamd      767146                            root    9r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
spamd      767146                            root   11r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
root@kanuka:/home/paule# /etc/init.d/spamassassin reload          
Reloading spamassassin configuration (via systemctl): spamassassin.service.
root@kanuka:/home/paule# lsof | grep spamd | grep GeoIP.dat | grep root
spamd      767863                            root    9r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
spamd      767863                            root   11r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
spamd      767863                            root   13r      REG                
8,5   2579835     260907 /usr/share/GeoIP/GeoIP.dat
Comment 1 Henrik Krohns 2023-05-10 18:19:46 UTC
This seems to be a bug only in Geo::IP, probably due to it's C-library bindings and stuff. Atleast GeoIP2 or DB_File do not leak.

I've committed a quick fix for spamd, but this doesn't fix the problem for amavisd or others that fork SpamAssassin the same way.

Sending        trunk/spamd/spamd.raw
Transmitting file data .done
Committing transaction...
Committed revision 1909726.

Needs some more analyzing whether it can be fixed for amavisd etc without needing to change code there. I'd rather keep the shared GeoDB instead of wasting resources for letting children to load them independently. Or just let it leak for them since there's really no good reason to use Geo::IP anymore.
Comment 2 Paul 2023-05-10 19:30:23 UTC
Thanks that sorts my immediate problem out and has me testing GeoLite2 at last
Comment 3 Henrik Krohns 2023-08-04 14:57:34 UTC
Postponing to future, nothing to change for 4.0.1 release