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

jackychen chen.zheng at easystack.cn
Sat Mar 1 02:26:04 UTC 2014


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/

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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-dev/attachments/20140301/fe4244ee/attachment.html>


More information about the OpenStack-dev mailing list