deadlock risk from using cache a load time
I'm encountering a nested call to apps.populate in 1.8.7 which causes deadlock at load time. It's called first from django.setup(), then from LocMemCache and the process hangs on a lock. I'm posting here because I think the problem is principally within django - the apps I'm using are doing reasonable things. I posted the details to django-users, but the only response I've gotten is a suggestion to ask you folks: https://groups.google.com/forum/#!topic/django-users/WiRzQ8EFOdo John -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/55d39e32-e636-4d47-8a3b-ccac7c68d5ca%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: deadlock risk from using cache a load time
> I wouldn't call multisite/hacks.py reasonable :D That said, unpickling > models requires apps to be populated (relations etc…), therefor do not > attempt to do such an action during population. > Thanks. Shai offered the same opinion and I'm following up with the django-cms developers. John -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1eda3642-48ba-464a-945f-d51fc9427f7e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: deadlock risk from using cache a load time
I got a patch from the django-cms folks that moves template loading into their AppConfig.ready() routine, but the problem persists. The last few lines of apps.populate are: self.models_ready = True for app_config in self.get_app_configs(): app_config.ready() self.ready = True At this point, django has the lock, app_config.ready() invokes the ready code for my apps, and I'm back where I started (nested call to apps.populate and deadlock). In db/models/base.py, in model_unpickle, I see this: if isinstance(model_id, tuple): if not apps.ready: apps.populate(settings.INSTALLED_APPS) model = apps.get_model(*model_id) Can that test instead be "if not apps.models_ready"? That would prevent the nested call and fix my problem. John -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/26b0709d-5298-4707-9a42-b4c4e4529e76%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
context = context.new(context)
I'm looking at code that does this: context = context.new(context) Prior to 1.7, I assume that worked since a context was a dict. Now that it's a stack, it breaks. I could suggest they use flatten: context = context.new(context.flatten()) but that's not exactly a copy, which is what I think they're after. What do you think they should be doing? John -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/1d653737-d69d-4c95-b50d-8f4ce5566a5d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.