#16022: Cyclic reference in FieldFile causes memory usage to grow considerably
-------------------------------------+-------------------------------------
Reporter: Gustavo Narea | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 1.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: memory leak | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Joshua Massover):
* status: closed => new
* ui_ux: => 0
* resolution: needsinfo =>
Comment:
I just got hit with this. I created a [https://github.com/massover
/possible-leak repo] with more info and tests that can reproduce the
issue. The code in production was a logging statement that was accessing
the file field. I only wanted to log the file name, not the file itself.
By removing the log of the file field entirely, our memory utilization
dropped by 1/4. The leaking model / file field is pretty crucial and is
used in a majority our endpoints.
{{{
# before
extra = {
"file_field": obj.file_field
"id": obj.id
}
logger.info("hello world!", extra=extra)
# after with 1/4 less memory usage and no other changes
extra = {
"id": obj.id
}
logger.info("hello world!", extra=extra)
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/16022#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/010701802002dfaa-bbf8e6f8-47de-4e69-97a8-f0acd10cd28a-000000%40eu-central-1.amazonses.com.