utils.cut_dict() returns more characters than the length parameter specifies

Bug #1760134 reported by Bob Haddleton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
Medium
Bob Haddleton

Bug Description

The utils.cut_dict() method returns a string representation of the provided dict, truncated to some number of characters that may or may not be close to the length parameter, depending on the structure and contents of the dict provided.

This can lead to hung workflows when the Execution.state_info field is not truncated properly due to the context variables involved:

2018-03-29T10:44:01.288362-05:00 mistral-server mistral-server: 2018-03-29 10:44:01,280 ERROR [-] Delayed call failed, method: <function _check_and_complete at 0x7fbf3d3c3d08>, exception: This Session's transaction has been rolled back due to a previous exception during flush. To begin a new transaction with this Session, first issue Session.rollback(). Original exception was: (_mysql_exceptions.DataError) (1406, "Data too long for column 'state_info' at row 1") [SQL: 'UPDATE task_executions_v2 SET updated_at=%s, state_info=%s WHERE task_executions_v2.id = %s'] [parameters: (datetime.datetime(2018, 3, 29, 15, 44, 1),

The cut_dict() method needs to return a string no longer than what the length parameter specifies to ensure that the state_info field is truncated properly and does not cause hung workflows.

Changed in mistral:
assignee: nobody → Bob Haddleton (bob-haddleton)
status: New → In Progress
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/557952

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

Reviewed: https://review.openstack.org/557952
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=0090fe28e0e0be199d14f86328eb69c5f1a77109
Submitter: Zuul
Branch: master

commit 0090fe28e0e0be199d14f86328eb69c5f1a77109
Author: Bob Haddleton <email address hidden>
Date: Fri Mar 30 10:09:04 2018 -0500

    Update cut_dict() to return no more than specified by length

    This patch updates the cut_dict() method to ensure that it only
    returns strings up to the length specified.

    Change-Id: Iecc1bd4f4c67606eed209a762e4d692691a37161
    Closes-Bug: 1760134

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

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/558905

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

Reviewed: https://review.openstack.org/558905
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=97a98ce050b635292938d1581ed5b527d08c9061
Submitter: Zuul
Branch: stable/queens

commit 97a98ce050b635292938d1581ed5b527d08c9061
Author: Bob Haddleton <email address hidden>
Date: Fri Mar 30 10:09:04 2018 -0500

    Update cut_dict() to return no more than specified by length

    This patch updates the cut_dict() method to ensure that it only
    returns strings up to the length specified.

    Change-Id: Iecc1bd4f4c67606eed209a762e4d692691a37161
    Closes-Bug: 1760134
    (cherry picked from commit 0090fe28e0e0be199d14f86328eb69c5f1a77109)

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

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

Dougal Matthews (d0ugal)
Changed in mistral:
milestone: none → rocky-1
Dougal Matthews (d0ugal)
Changed in mistral:
importance: Undecided → Medium
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 6.0.2

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