[openstack-dev] [horizon][infra][oslo][db]Sync notifier module from oslo-incubator met django DatabseError

Ben Nemec openstack at nemebean.com
Mon Mar 3 15:21:31 UTC 2014


 

On 2014-02-28 20:26, jackychen wrote: 

> hi, 
> I have commit a patch to sync notifier module under horizon with oslo-incubator, I met the gate-horizon-python error, all the errors are aimed at DatabseError.
> Code Review Link: https://review.openstack.org/#/c/76439/ [1]
> 
> The specific error: django.db.utils.DatabaseError: DatabaseWrapper objects created in a thread can only be used in that same thread. The object with alias 'default' was created in thread id 140664492599040 and this is thread id 56616752.
> 
> So I have google it and find that there are two ways to fix this
> 
> 1. https://code.djangoproject.com/ticket/17998 [2]
> import eventlet
> eventlet.monkey_patch()
> 
> 2.https://bitbucket.org/akoha/django-digest/issue/10/conflict-with-global-databasewrapper
> replace
> cursor = self.db.connection.cursor()
> with
> cursor = db.connections[DEFAULT_DB_ALIAS].cursor()
> everywhere it appears in storage.py, and add to the imports:
> from django import db from django.db.utils import DEFAULT_DB_ALIAS
> 
> Anyway, all these two solution are all not can be handled in my code commit, 
> So do you have any point of view to make this work?
> Thanks for all your help.

I believe that in other projects we monkeypatch eventlet, but I don't
know for sure if that's the appropriate fix here. Adding oslo and db
tags so those people will see this too.

-Ben

 

Links:
------
[1] https://review.openstack.org/#/c/76439/
[2] https://code.djangoproject.com/ticket/17998
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140303/b3e72828/attachment.html>


More information about the OpenStack-dev mailing list