No _writer_maker attribute on enginefacade.writer

Bug #1477080 reported by Julien Danjou
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.db
Fix Released
Medium
Mike Bayer

Bug Description

I've tried using it but it fails with the following traceback. This is either a bug or a "documentation problem" that does not enable me to use it correctly. ;)

gnocchi.tests.test_indexer.TestIndexerDriver.test_update_resource_end_timestamp
-------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    Traceback (most recent call last):
      File "gnocchi/tests/base.py", line 50, in skip_if_not_implemented
        return func(*args, **kwargs)
      File "gnocchi/tests/base.py", line 361, in setUp
        self.index.upgrade(nocreate=True)
      File "/Users/jd/Source/gnocchi/.tox/py27-postgresql-swift/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 664, in wrapper
        with self._transaction_scope(context):
      File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "/Users/jd/Source/gnocchi/.tox/py27-postgresql-swift/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 714, in _transaction_scope
        savepoint=self._savepoint) as resource:
      File "/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__
        return self.gen.next()
      File "/Users/jd/Source/gnocchi/.tox/py27-postgresql-swift/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 484, in _session
        bind=self.connection, mode=self.mode)
      File "/Users/jd/Source/gnocchi/.tox/py27-postgresql-swift/lib/python2.7/site-packages/oslo_db/sqlalchemy/enginefacade.py", line 279, in _create_session
        return self._writer_maker(**kw)
    AttributeError: '_TransactionFactory' object has no attribute '_writer_maker'

Revision history for this message
Mike Bayer (zzzeek) wrote :

hi julien -

can you show me the setup code for this? if you're on enginefacade then everything has to be within a context. this is definitely bad error reporting on its part but it seems maybe you aren't in a context block/decorator here?

Changed in oslo.db:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Julien Danjou (jdanjou) wrote :

Hi Mike!

So I've just sent the patch at https://review.openstack.org/#/c/204669/1/gnocchi/indexer/sqlalchemy.py

I've copied what I saw in the example at http://docs.openstack.org/developer/oslo.db/usage.html#session-handling, I just skipped the custom MyContext class as I don't need anything fancy.

Changed in oslo.db:
assignee: nobody → Mike Bayer (zzzeek)
status: Confirmed → In Progress
Revision history for this message
Yongli He (yongli-he) wrote :

Inel PCI CI also hit this bug:
here is a log link:
http://52.27.155.124/243557/2/screen-logs/n-api.log.gz

and major port of this log:

2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions return IMPL.network_get_all(context, project_only)
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 204, in wrapper
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions return f(*args, **kwargs)
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 2920, in network_get_all
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions project_only=project_only).all()
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 266, in model_query
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions session = get_session(use_slave=use_slave)
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions File "/opt/stack/nova/nova/db/sqlalchemy/api.py", line 172, in get_session
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions use_slave=use_slave, **kwargs)
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions File "/usr/local/lib/python2.7/dist-packages/oslo_db/sqlalchemy/enginefacade.py", line 977, in get_session
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions return self._factory._writer_maker(**kwargs)
2015-11-11 20:49:17.715 106701 ERROR nova.api.openstack.extensions AttributeError: '_TransactionFactory' object has no attribute '_writer_maker'

Revision history for this message
Mike Bayer (zzzeek) wrote :

this issue has to do with using enginefacade in a non-initialized state. But the bug here is a gnochhi issue AFAICT and the patch I've put up to correct it can be seen at https://review.openstack.org/#/c/204669/. if we are just looking for a nicer error message in oslo, that's something else but it's misleading IMO for this bug to be assigned to oslo.db.

Revision history for this message
Mike Bayer (zzzeek) wrote :

please post the Nova stack trace here as a new issue on Nova, assuming this has to do with the patches for https://blueprints.launchpad.net/nova/+spec/new-oslodb-enginefacade the issue would exist within the realm of the enginefacade being used outside of the correct context.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :
Revision history for this message
Mike Bayer (zzzeek) wrote :
Changed in oslo.db:
status: In Progress → Fix Committed
Changed in oslo.db:
milestone: none → 3.2.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.