executions update with postgresql result in cannot adapt type dict

Bug #1491541 reported by Winson Chan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Winson Chan

Bug Description

When updating executions (state or description), the API return error can't adapt type 'dict' if database backend is postgresql. Also, the RPC client is unable to parse the DBError from exceptions module and return a different error to the user.

2015-09-02 18:30:38,941 140005826849680 ERROR dispatcher [-] Exception during message handling: (psycopg2.ProgrammingError) can't adapt type 'dict' [SQL: 'UPDATE executions_v2 SET updated_at=%(updated_at)s, state=%(state)s, state_info=%(state_info)s WHERE executions_v2.id = %(executions_v2_id)s'] [parameters: {'state_info': {}, 'executions_v2_id': u'9a6d0f7f-f4c7-4b92-b1b8-a327bf270b57', 'state': 'ERROR', 'updated_at': datetime.datetime(2015, 9, 2, 18, 30, 38, 938577)}]
Traceback (most recent call last):
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 142, in _dispatch_and_reply
    executor_callback))
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 186, in _dispatch
    executor_callback)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/oslo_messaging/rpc/dispatcher.py", line 129, in _do_dispatch
    result = func(ctxt, **new_args)
  File "/home/vagrant/code/openstack/mistral/mistral/engine/rpc.py", line 213, in stop_workflow
    return self._engine.stop_workflow(execution_id, state, message)
  File "/home/vagrant/code/openstack/mistral/mistral/utils/__init__.py", line 106, in _logged
    return func(*args, **kw)
  File "/home/vagrant/code/openstack/mistral/mistral/engine/default_engine.py", line 355, in stop_workflow
    return self._stop_workflow(wf_ex, state, message)
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/vagrant/code/openstack/mistral/mistral/db/v2/api.py", line 59, in transaction
    yield
  File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
    self.gen.next()
  File "/home/vagrant/code/openstack/mistral/mistral/db/v2/sqlalchemy/api.py", line 87, in transaction
    commit_tx()
  File "/home/vagrant/code/openstack/mistral/mistral/db/v2/sqlalchemy/api.py", line 71, in commit_tx
    b.commit_tx()
  File "/home/vagrant/code/openstack/mistral/mistral/db/sqlalchemy/base.py", line 143, in commit_tx
    ses.commit()
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 790, in commit
    self.transaction.commit()
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 392, in commit
    self._prepare_impl()
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 372, in _prepare_impl
    self.session.flush()
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2004, in flush
    self._flush(objects)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2122, in _flush
    transaction.rollback(_capture_exception=True)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
    compat.reraise(exc_type, exc_value, exc_tb)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/session.py", line 2086, in _flush
    flush_context.execute()
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 373, in execute
    rec.execute(self)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/unitofwork.py", line 532, in execute
    uow
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 170, in save_obj
    mapper, table, update)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/orm/persistence.py", line 692, in _emit_update_statements
    execute(statement, multiparams)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute
    return meth(self, multiparams, params)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
    context)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception
    util.raise_from_cause(newraise, exc_info)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 199, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
    context)
  File "/opt/openstack/mistral/.venv/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute
    cursor.execute(statement, parameters)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/219870
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=e80ae92c7395db2bc9f0f336b23d871ce94259dd
Submitter: Jenkins
Branch: master

commit e80ae92c7395db2bc9f0f336b23d871ce94259dd
Author: Winson Chan <email address hidden>
Date: Wed Sep 2 20:00:49 2015 +0000

    Fix execution update where state_info is unset

    If state_info is unset, the wsme UnsetType will be translated to
    dict to the RPC engine client. Set update message to None if
    state_info is unset.

    Closes-Bug: #1491541
    Change-Id: I4aecb2aa22f2382ef419cbc5342264273d1e4a2a

Changed in mistral:
status: New → Fix Committed
Changed in mistral:
milestone: none → liberty-3
assignee: nobody → Winson Chan (winson-c-chan)
importance: Undecided → High
Changed in mistral:
status: Fix Committed → Fix Released
Changed in mistral:
milestone: liberty-3 → liberty
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.