Action execution checker doesn't set a security context

Bug #1805080 reported by Renat Akhmerov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Renat Akhmerov

Bug Description

Mistral doesn't set a security context for the action execution checker thread. Because of that Mistral gets an error in some cases (when a workflow specification is not cached):

2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker [-] Action execution checker iteration failed due to unexpected exception.: ApplicationContextNotFoundException: Application context not found
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker Traceback (most recent call last):
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/services/action_execution_checker.py", line 76, in _loop
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker handle_expired_actions()
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/db/utils.py", line 88, in decorate
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker return retry.call(_with_auth_context, auth_ctx, func, *args, **kw)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/tenacity/__init__.py", line 330, in call
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker start_time=start_time)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/tenacity/__init__.py", line 279, in iter
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker return fut.result()
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/concurrent/futures/_base.py", line 422, in result
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker return self.__get_result()
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/tenacity/__init__.py", line 333, in call
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker result = fn(*args, **kwargs)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/db/utils.py", line 45, in _with_auth_context
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker return func(*args, **kw)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/engine/post_tx_queue.py", line 78, in decorate
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker res = func(*args, **kw)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/services/action_execution_checker.py", line 68, in handle_expired_actions
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker action_handler.on_action_complete(action_ex, result)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 159, in wrapper
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker result = f(*args, **kwargs)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/engine/action_handler.py", line 34, in on_action_complete
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker action = _build_action(action_ex)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/osprofiler/profiler.py", line 159, in wrapper
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker result = f(*args, **kwargs)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/engine/action_handler.py", line 94, in _build_action
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker action_ex.task_execution.workflow_execution_id
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/cachetools/__init__.py", line 60, in wrapper
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker v = func(*args, **kwargs)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/lang/parser.py", line 224, in get_workflow_spec_by_execution_id
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker wf_ex = db_api.get_workflow_execution(wf_ex_id)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/db/v2/api.py", line 254, in get_workflow_execution
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker return IMPL.get_workflow_execution(id, fields=fields)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/db/sqlalchemy/base.py", line 117, in _within_session
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker result = func(*args, **kw)
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/db/v2/sqlalchemy/api.py", line 809, in get_workflow_execution
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker ctx = context.ctx()
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker File "/usr/lib/python2.7/site-packages/mistral/context.py", line 122, in ctx
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker raise exc.ApplicationContextNotFoundException()
2018-11-25 00:01:07.392 11052 ERROR mistral.services.action_execution_checker ApplicationContextNotFoundException: Application context not found

Changed in mistral:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Renat Akhmerov (rakhmerov)
milestone: none → stein-2
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/619964

Changed in mistral:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/620067

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

Reviewed: https://review.openstack.org/619964
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=3153f1ca584450bdd1b983b8ebc13ef5cb809c0e
Submitter: Zuul
Branch: master

commit 3153f1ca584450bdd1b983b8ebc13ef5cb809c0e
Author: Renat Akhmerov <email address hidden>
Date: Mon Nov 26 13:38:53 2018 +0700

    Set admin security context in the action execution checker thread

    Change-Id: I4c7abff04b8797618294d9e13fbec4b5876bcdb6
    Closes-Bug: #1805080

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (stable/rocky)

Reviewed: https://review.openstack.org/620067
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=5e5901bb8de5c93c7bd2e541c76d37bd93a413e6
Submitter: Zuul
Branch: stable/rocky

commit 5e5901bb8de5c93c7bd2e541c76d37bd93a413e6
Author: Renat Akhmerov <email address hidden>
Date: Mon Nov 26 13:38:53 2018 +0700

    Set admin security context in the action execution checker thread

    Change-Id: I4c7abff04b8797618294d9e13fbec4b5876bcdb6
    Closes-Bug: #1805080

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 8.0.0.0b1

This issue was fixed in the openstack/mistral 8.0.0.0b1 development milestone.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 7.1.0

This issue was fixed in the openstack/mistral 7.1.0 release.

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.