Workflow._fail_workflow() may fail if "output_on_error" is not empty

Bug #1690316 reported by Renat Akhmerov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Ritesh Paiboina

Bug Description

The method looks like (with the beginning omitted):

    def _fail_workflow(self, final_context, msg):
        ....

        # When we set an ERROR state we should safely set output value getting
        # w/o exceptions due to field size limitations.
        msg = utils.cut_by_kb(
            msg,
            cfg.CONF.engine.execution_field_size_limit_kb
        )

        self.wf_ex.output = merge_dicts({'result': msg}, output_on_error)

        if self.wf_ex.task_execution_id:
            self._schedule_send_result_to_parent_workflow()

So, we first use utils.cut_by_kb() for "msg" but then, essentially, add 'output_on_error' to it so the resulting size of 'output' may be greater than cfg.CONF.engine.execution_field_size_limit_kb

Changed in mistral:
milestone: none → pike-2
Changed in mistral:
status: New → Confirmed
importance: Undecided → High
assignee: nobody → Renat Akhmerov (rakhmerov)
description: updated
summary: - workflow_handler._fail_workflow() may fail if "output_on_error" is not
- empty
+ Workflow._fail_workflow() may fail if "output_on_error" is not empty
Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

The right fix seems to be the following:
* Calculate size of "output_on_error".
* If it's greater than config option:
** Log the full message and "output_on_error"
** Raise an exception (we can't ignore configuration)
* If it's less:
** Log the full message
** Cut "msg" according what's left after counting "output_on_error".

Changed in mistral:
assignee: Renat Akhmerov (rakhmerov) → nobody
Changed in mistral:
milestone: pike-2 → pike-3
Changed in mistral:
milestone: pike-3 → pike-rc1
Revision history for this message
Ritesh Paiboina (rsritesh) wrote :

Hello Renant,

Can you describe how can I reproduce a scenario where workflow is a failure and this function is being called Workflow._fail_workflow()

Perhaps any command or rest api call , this help to understand better what is going inside this function
Workflow._fail_workflow()

Accordingly I can also write a test case for this.

Thank you
Ritesh

Changed in mistral:
assignee: nobody → Ritesh (rsritesh)
Revision history for this message
Renat Akhmerov (rakhmerov) wrote :

Hi,

You should run a workflow like this:

wf:
  output-on-error: <some not empty content (e.g. YAQL expression)>
  tasks:
    task1:
      ... <it should fail so that the workflow fails too and triggers "output-on-error" clause>

Changed in mistral:
status: Confirmed → In Progress
Changed in mistral:
milestone: pike-rc1 → queens-1
Changed in mistral:
milestone: queens-1 → queens-2
Changed in mistral:
status: In Progress → New
assignee: Ritesh (rsritesh) → nobody
Changed in mistral:
milestone: queens-2 → none
Changed in mistral:
milestone: none → queens-rc1
assignee: nobody → ritesh (ritesh)
assignee: ritesh (ritesh) → Ritesh (rsritesh)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/490414
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=5691ddf94af6bb34b052c9ff2e9dbfa4567ee79d
Submitter: Zuul
Branch: master

commit 5691ddf94af6bb34b052c9ff2e9dbfa4567ee79d
Author: rsritesh <email address hidden>
Date: Thu Aug 3 12:21:02 2017 +0200

    Consider size of output_on_error

    While printing the output of a execution
    size of output_on_error is not considered
    with the field_size_limit_kb

    This patch udpates the function to include
    the logical calculation of total size limit

    Closes-Bug: #1690316
    Change-Id: Icab63d147f580b8d72d8c02b3d9261fd64d3438a

Changed in mistral:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 6.0.0.0rc1

This issue was fixed in the openstack/mistral 6.0.0.0rc1 release candidate.

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.