An error occurs when fetching a workflow execution

Bug #1846152 reported by Renat Akhmerov
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Critical
Renat Akhmerov

Bug Description

When fetching a workflow execution via API we're getting the following error:

2019-09-25 10:41:45.927 22657 ERROR wsme.api [req-67531f0e-abc2-4fee-9141-46fc40a18b56 - - - - -] Server-side error: "Parent instance <WorkflowExecution at 0x7fcbd0a67940> is not bound to a Session; lazy load operation of attribute 'root_execution' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)". Detail:
Traceback (most recent call last):

  File "/usr/local/lib/python3.6/dist-packages/wsmeext/pecan.py", line 85, in callfunction
    result = f(self, *args, **kwargs)

  File "/opt/mistral/mistral/api/controllers/v2/execution.py", line 127, in get
    wf_ex)

  File "/opt/mistral/mistral/api/controllers/v2/execution.py", line 92, in _get_published_global_from_tasks
    published_global_vars = task.get_published_global(task_ex, wf_ex)

  File "/opt/mistral/mistral/api/controllers/v2/task.py", line 83, in get_published_global
    get_workflow_environment_dict(wf_ex),

  File "/opt/mistral/mistral/workflow/data_flow.py", line 334, in get_workflow_environment_dict
    return get_workflow_environment_dict(wf_ex.root_execution)

  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/attributes.py", line 282, in __get__
    return self.impl.get(instance_state(instance), dict_)

  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/attributes.py", line 710, in get
    value = self.callable_(state, passive)

  File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/strategies.py", line 688, in _load_for_state
    % (orm_util.state_str(state), self.key)

sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <WorkflowExecution at 0x7fcbd0a67940> is not bound to a Session; lazy load operation of attribute 'root_execution' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)
: sqlalchemy.orm.exc.DetachedInstanceError: Parent instance <WorkflowExecution at 0x7fcbd0a67940> is not bound to a Session; lazy load operation of attribute 'root_execution' cannot proceed (Background on this error at: http://sqlalche.me/e/bhk3)

Changed in mistral:
milestone: none → train-rc2
assignee: nobody → Renat Akhmerov (rakhmerov)
importance: Undecided → Critical
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.opendev.org/685899

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

Fix proposed to branch: stable/train
Review: https://review.opendev.org/686349

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

Reviewed: https://review.opendev.org/685899
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=7a6aac0f5f008d67eeb5d3f63ddac42bb62f8e69
Submitter: Zuul
Branch: master

commit 7a6aac0f5f008d67eeb5d3f63ddac42bb62f8e69
Author: Renat Akhmerov <email address hidden>
Date: Thu Sep 26 17:48:40 2019 +0700

    Fix "root_execution" lazy loading issue and refactor execution.py

    * There's an issue with lazyly loaded field of WorkflowExecution
      model occuring on GET /v2/execution/<id> because the logic
      that calculates "published_global" of the execution rest resource
      hits "root_execution" field out of transaction scope indirectly
      within the "data_flow.get_workflow_environment_dict" method.
      This patch makes refactoring of this logic and calculates
      globally published variables of the workflow execution simply
      as its context that doesn't contain all internal data like
      "__execution" and "openstack".
    * Other style change.

    Closes-Bug: #1846152
    Change-Id: Ic8609e55930e2ed13653e79e8ca7a31c951d9030

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

Reviewed: https://review.opendev.org/686349
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=33d4a8bba35d79e8216d5babce48bbd04acfdfbd
Submitter: Zuul
Branch: stable/train

commit 33d4a8bba35d79e8216d5babce48bbd04acfdfbd
Author: Renat Akhmerov <email address hidden>
Date: Thu Sep 26 17:48:40 2019 +0700

    Fix "root_execution" lazy loading issue and refactor execution.py

    * There's an issue with lazyly loaded field of WorkflowExecution
      model occuring on GET /v2/execution/<id> because the logic
      that calculates "published_global" of the execution rest resource
      hits "root_execution" field out of transaction scope indirectly
      within the "data_flow.get_workflow_environment_dict" method.
      This patch makes refactoring of this logic and calculates
      globally published variables of the workflow execution simply
      as its context that doesn't contain all internal data like
      "__execution" and "openstack".
    * Other style change.

    Closes-Bug: #1846152
    Change-Id: Ic8609e55930e2ed13653e79e8ca7a31c951d9030

tags: added: in-stable-train
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 9.0.0.0rc2

This issue was fixed in the openstack/mistral 9.0.0.0rc2 release candidate.

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

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

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.