contrib/gis/utils/geoip.py GeoIP leaks file handles
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)
Component: |
Contrib apps → GIS
|
Owner: |
changed from nobody to jbronn
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
Example of we patched the leak by subclassing GeoIP: