django-dirtyfields: Infinite loop when using double MonitorField from django-model-utils with defer()/only()

We just upgraded to Django 1.10 and use DirtyFieldsMixin all over the place. After much debugging after finding an issue, we’ve noticed that when using .only() or .defer() with .get() on a model that subclasses DirtyFieldsMixin, you will end up in an infinite loop that maxes out with a maximum recursion error.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 28 (13 by maintainers)

Most upvoted comments

I finally managed to write a failing test!

https://travis-ci.org/jdotjdot/django-dirtyfields

Sorry about that @vannitotaro… I thought I released a new version few time ago. Thanks for investigating!

I will release a new version tomorrow!

I managed to reproduce the issue in django-model-utils project: https://github.com/carljm/django-model-utils/issues/241

@vannitotaro good news! I will update the issue title after I’m sure that’s related only to MonitorField.

@vannitotaro @jdotjdot Version 1.2.1 is live and available on pypi. Please check with this version!

Just tried my testcase on a standalone run of django-dirtyfields tox and no RuntimeError is raised… I’ll try to understand what’s missing to trigger the exception.

Sounds a regression of #84 😢

Some tests have been written to cover it. Seems not enough.

@vannitotaro can you give more context? The definition of MyDirtyFieldsModel? In which context are you calling this only?

If you could write a test to reproduce it, it would help me to fix it (I have tried a basic model and only call, but can’t reproduce this recursive error…).

@vannitotaro you rock–so it’s not just me. I reproduce it every time in our codebase, but so far I have not been able to properly write a failing test. It’s very odd.

It looks like this may be an odd conflict with MonitorField from django-model-utils. I’m continuing to investigate.