| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
I don't think that this change deserves a NEWS entry. |
Sorry, something went wrong.
There was a problem hiding this comment.
I suspect that there are leaks when self->type is set to TYPE_NOT_STARTED.
Sorry, something went wrong.
|
allocated_buffer and user_buffer are members of mutually exclusive C union type. |
Sorry, something went wrong.
Oh right... My previous memory leak fix was incomplete :-( I updated this PR to always clear the overlapped on failure, but also implemen tp_clear slot. Does it look better now? |
Sorry, something went wrong.
Fix memory leaks in asyncio ProactorEventLoop on overlapped operation failure. Changes: * Implement the tp_traverse slot in the _overlapped.Overlapped type to help to break reference cycles and identify referrers in the garbage collector. * Always clear overlapped on failure: not only set type to TYPE_NOT_STARTED, but release also resources.
|
I changed my mind. It's wrong to implement tp_clear: if a buffer memory is release while an overlapped is still running, the process will crash. In practice, we shouldn't get into a case where tp_clear is called on a running ("pending") overlapped operation, but I prefer to be pendantic because overlapped are very tricky and error prone. I amended my change to be able to edit the commit message: and to no longer define tp_clear. |
Sorry, something went wrong.
|
It is OK to not implement tp_clear. Not every object that provides tp_traverse should provide tp_clear. Maybe make allocated_buffer and user_buffer not members of a union? Then you can traverse/clear without depending on type. |
Sorry, something went wrong.
I don't think that it would simplify much the code. An overlapped is used for a single action and then is destroyed. Its type shouldn't change, and I'm fine with the current switch() to factorize the code. |
Sorry, something went wrong.
|
Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.7. |
Sorry, something went wrong.
|
GH-11519 is a backport of this pull request to the 3.7 branch. |
Sorry, something went wrong.
Fix memory leaks in asyncio ProactorEventLoop on overlapped operation failures. Changes: * Implement the tp_traverse slot in the _overlapped.Overlapped type to help to break reference cycles and identify referrers in the garbage collector. * Always clear overlapped on failure: not only set type to TYPE_NOT_STARTED, but release also resources. (cherry picked from commit 5485085) Co-authored-by: Victor Stinner <vstinner@redhat.com>
Fix memory leaks in asyncio ProactorEventLoop on overlapped operation failures. Changes: * Implement the tp_traverse slot in the _overlapped.Overlapped type to help to break reference cycles and identify referrers in the garbage collector. * Always clear overlapped on failure: not only set type to TYPE_NOT_STARTED, but release also resources. (cherry picked from commit 5485085) Co-authored-by: Victor Stinner <vstinner@redhat.com>
| Back | FazBrowse Home | New Git URL |
Fix memory leaks in asyncio ProactorEventLoop on overlapped operation
failure.
Changes:
_overlapped.Overlapped type to help to break reference cycles and
identify referrers in the garbage collector.
and release resources.
https://bugs.python.org/issue32710