contrib/gis/utils/geoip.py GeoIP leaks file handles
|Reported by:||andrewfox||Owned by:||jbronn|
|Severity:||Keywords:||geodjango, gis, geoip, ctype, leak, file handle|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
The GeoIP wrapper object in contrib.gis.utils.geoip.py does not seem to clean the referenced GeoIP c library database fopen'd files up. The init of GeoIP proceeds to load the city and the country dbs via the geoip c library in line 188 but does not ever seem to properly cleanup the opened dbs by calling the GeoIP_delete function in the same C library. This leaves file handles open to the various dat files which can overwealm the ulimits for certain process configurations.
Workaround is to manually call the delete functon on the self._city and self._country via ctypes but seems like it should be handled by the del of the GeoIP object.
Change History (4)
comment:1 Changed 5 years ago by anonymous
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
comment:2 Changed 5 years ago by jbronn
- Component changed from Contrib apps to GIS
- Owner changed from nobody to jbronn