-
-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak because session is not closed #195
Comments
Worth checking this bug: psf/requests#4601 The only way this can be done transparently, is to do it in del method of ReplicationServer, though it's kind of band-aid. |
Barking up the wrong tree, it turns out. It's the MergeInputReader that doesn't properly release the downloaded buffers. We still should be closing the sessions and requests properly. |
PyObject_GetBuffer needs a PyObject_Release which was missing. Use pybind11's buffer_info as a resource controller. We can't use the request() function from py::buffer because it uses a different set of flags. See osmcode#195.
Memory leak fixed in b8b4b72. Proper closing of sessions in bd4daeb. Sessions will now only held open, when ReplicationServer is used in context manager mode (i.e. with a |
The ReplicationServer opens a requests session which is never closed. The result is a memory leak.
See osm-search/Nominatim#2575 for a practical case where this is an issue.
I'm not sure if this can be resolved transparently. We may have to introduce a
close()
function for ReplicationServer to fix the issue.Addendum: this is not a new bug that came in with the requests implementation. The urllib code had the same behaviour.
The text was updated successfully, but these errors were encountered: