"state_info" is not always trimmed properly

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

Bug Description

When Mistral engine stores an execution object it trims field "state_info" to make sure it fits into 65535 bytes (maximum size of MySQL TEXT type). However, if the initial value that is going into "state_info" is a dictionary (e.g. an action returned it as a result) then the method utils.cut() can return a dict whose string representation will slightly go beyond the expected limit. In this case we'll get a DB error. This is related to how method utils.cut_dict() works internally. In other words, it doesn't provide a guarantee that it will be exactly of the expected length.

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

Reviewed: https://review.openstack.org/474195
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=5a43d54a058ea4e13924c596b0bee93b727a1f95
Submitter: Jenkins
Branch: master

commit 5a43d54a058ea4e13924c596b0bee93b727a1f95
Author: Renat Akhmerov <email address hidden>
Date: Wed Jun 14 20:10:03 2017 +0700

    Make sure that the field "state_info" trimmed as expected

    * Before this patch, "state_info" field of execution objects
      wasn't truncated properly before saving into DB which led to
      the DB error like:
        DBDataError: (_mysql_exceptions.DataError) (1406, "Data too
        long for column 'state_info' at row 1")
      It was happening because the method utils.cut() didn't work
      accurately enough in case if we passed it with a dictionary.
      This patch doesn't fix utils.cut() method but it just saves
      space for possible method result difference with the expected
      length so that we make sure that the truncated string
      representation is always less than 65536 bytes (i.e. the size
      of MySQL TEXT type). The total difference is not critical
      anyway.

    Closes-Bug: #1698125
    Change-Id: I18449710ace6276224aaea564588c53a3e2c6adc

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

Fix proposed to branch: stable/ocata
Review: https://review.openstack.org/475316

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

Reviewed: https://review.openstack.org/475316
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=c15c378011702bde2e29922d238ed8b9b9688f39
Submitter: Jenkins
Branch: stable/ocata

commit c15c378011702bde2e29922d238ed8b9b9688f39
Author: Renat Akhmerov <email address hidden>
Date: Wed Jun 14 20:10:03 2017 +0700

    Make sure that the field "state_info" trimmed as expected

    * Before this patch, "state_info" field of execution objects
      wasn't truncated properly before saving into DB which led to
      the DB error like:
        DBDataError: (_mysql_exceptions.DataError) (1406, "Data too
        long for column 'state_info' at row 1")
      It was happening because the method utils.cut() didn't work
      accurately enough in case if we passed it with a dictionary.
      This patch doesn't fix utils.cut() method but it just saves
      space for possible method result difference with the expected
      length so that we make sure that the truncated string
      representation is always less than 65536 bytes (i.e. the size
      of MySQL TEXT type). The total difference is not critical
      anyway.

    Closes-Bug: #1698125
    Change-Id: I18449710ace6276224aaea564588c53a3e2c6adc
    (cherry picked from commit 5a43d54a058ea4e13924c596b0bee93b727a1f95)

tags: added: in-stable-ocata
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 5.0.0.0b3

This issue was fixed in the openstack/mistral 5.0.0.0b3 development milestone.

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

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