-
Notifications
You must be signed in to change notification settings - Fork 825
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
fix: resolves #1443 - closes image when context cleanup #1623
base: master
Are you sure you want to change the base?
Conversation
Pull Request Test Coverage Report for Build 9430683271Details
💛 - Coveralls |
@scorphus @heynemann What do you think? |
Kudos, SonarCloud Quality Gate passed!
|
self.context.filters_factory = None | ||
self.context.metrics = None | ||
self.context.thread_pool = None | ||
self.context.transformer = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These lines are being deleted but no new code deals with those attributes. Should this be of any concern?
if hasattr(self, "modules") and self.modules: | ||
self.modules.cleanup() | ||
|
||
self.thread_pool.cleanup() | ||
if hasattr(self, "request") and self.request.engine: | ||
self.request.engine.cleanup() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can request
ever be None
or something else other than expected in a way that line 81 raises something like "AttributeError: 'NoneType' object has no attribute 'engine'"?
self.cleanup() | ||
|
||
def cleanup(self): | ||
if hasattr(self, "modules") and self.modules: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line — and probably line 81 as well, more or less in the same way — could read like the following:
if hasattr(self, "modules") and self.modules: | |
if getattr(self, "modules", None): |
This PR is stale because it has been open 60 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 30 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information. |
|
This PR is stale because it has been open 60 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 30 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information. |
|
This PR is stale because it has been open 60 days with no activity. Remove the stale label or add a comment, or this PR will be closed in 30 days. You can always re-open if you feel this is something we should still keep working on. Tag @heynemann for more information. |
|
Resolves #1443
After Thumbor finish the request, a cleanup method is called. But the Pillow Image pointer remained alive.
Testing locally, Thumbor was able to clean remaining memory.
Before changes:
After changes:
memory-profile was used to calculate memory allocation and deallocation.