malformed json when result is transferred to state_info

Bug #1662350 reported by Winson Chan
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Released
Hardik Jasani

Bug Description

Given a dict in the task result, the double quotes are removed from the state info leading to a malformed json.

vagrant@arkham:~/st2$ mistral task-get-result 24231044-046e-4b27-b738-e031372b4d5d
    "error": "Execution canceled by user."

vagrant@arkham:~/st2$ mistral task-get 24231044-046e-4b27-b738-e031372b4d5d
| Field | Value |
| ID | 24231044-046e-4b27-b738-e031372b4d5d |
| Name | task1 |
| Workflow name | examples.mistral-test-cancel |
| Execution ID | 19d2e289-bab1-41d4-bc4c-4cc7bba71e91 |
| State | ERROR |
| State info | {error: Execution canceled by user.} |
| Created at | 2017-02-06 22:01:45 |
| Updated at | 2017-02-06 22:01:49 |

Changed in mistral:
importance: Undecided → Medium
assignee: nobody → Anastasia Kuznetsova (akuznetsova)
Changed in mistral:
milestone: none → pike-1
Revision history for this message
Anastasia Kuznetsova (akuznetsova) wrote :

Hello Winson,

Can you help me a little bit?
I can't reproduce such case:
- I can get result in a dict format, but task status is SUCCESS and state_info is None
- I can reproduce situation when task status is ERROR, but state_info is not a dict.

So I am trying to use CANCEL feature like you've used, I think.
Here is my wf:
version: "2.0"

  type: direct
      action: std.sleep seconds=60

I do following:
mistral workflow-create wf.yaml
mistral execution-create wf
mistral execution-update -s CANCELLED <id>

Wf goes to CANCELLED status, but TASK is still RUNNING, so I can't get message like in the description. As for me it looks like a bug.

Could you please provide your steps?

Changed in mistral:
milestone: pike-1 → pike-2
Revision history for this message
Winson Chan (winson-c-chan) wrote :

I don't think you'll need to test w/ cancel. How about writing a test workflow with a task that runs an asynchronous and then update the task w/ an error and additional info which contains JSON?

Changed in mistral:
milestone: pike-2 → pike-3
Changed in mistral:
milestone: pike-3 → queens-1
Changed in mistral:
assignee: Anastasia Kuznetsova (akuznetsova) → noa (noa-koffman)
Changed in mistral:
milestone: queens-1 → queens-2
Changed in mistral:
milestone: queens-2 → queens-3
Changed in mistral:
assignee: noa (noa-koffman) → Hardik Jasani (hjasani)
Changed in mistral:
milestone: queens-3 → queens-rc1
Hardik Jasani (hjasani)
Changed in mistral:
status: New → In Progress
Changed in mistral:
milestone: queens-rc1 → queens-rc2
Changed in mistral:
milestone: queens-rc2 → rocky-1
tags: added: queens-backport
Revision history for this message
Hardik Jasani (hjasani) wrote :

Minimal workflow to reproduce bug:

version: "2.0"

  type: direct
      action: std.test_dict
        size: 1
        key_prefix: "abc"
        val: "pqr"
        - fail msg="<% task().result %>"

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

Fix proposed to branch: master

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

Submitter: Zuul
Branch: master

commit 6de2c15e6ac99a100478230e26af945beb1439f9
Author: hardikj <email address hidden>
Date: Mon Apr 9 18:23:29 2018 +0530

    Fix malformed state_info when json is set to it

    Fix bug where setting a dict to state_info did not convert to
    JSON format properly.

    Change-Id: Ib78d65483dd628e03de2484d3176ab7f275bc9d6
    Closes-bug: #1662350

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

This issue was fixed in the openstack/mistral 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.