local variable 'update_task' referenced before assignment

Bug #1561066 reported by Jason Dunsmore
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Jason Dunsmore

Bug Description

The following traceback was encountered when creating
http://paste.openstack.org/show/491595/

..which failed creation, and then updating with the following template
http://paste.openstack.org/show/491602/

Traceback (most recent call last):
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/service.py", line 126, in log_exceptions
    gt.wait()
  File "/opt/heat/lib/python2.7/site-packages/eventlet/greenthread.py", line 175, in wait
    return self._exit_event.wait()
  File "/opt/heat/lib/python2.7/site-packages/eventlet/event.py", line 125, in wait
    current.throw(*self._exc)
  File "/opt/heat/lib/python2.7/site-packages/eventlet/greenthread.py", line 214, in main
    result = function(*args, **kwargs)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/service.py", line 117, in _start_with_trace
    return func(*args, **kwargs)
  File "/opt/heat/lib/python2.7/site-packages/osprofiler/profiler.py", line 117, in wrapper
    return f(*args, **kwargs)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/stack.py", line 86, in handle_exceptions
    {'func': func.__name__, 'msg': errmsg})
  File "/opt/heat/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
    self.force_reraise()
  File "/opt/heat/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
    six.reraise(self.type_, self.value, self.tb)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/stack.py", line 81, in handle_exceptions
    return func(stack, *args, **kwargs)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/stack.py", line 1104, in update
    updater()
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/scheduler.py", line 169, in __call__
    self.start(timeout=timeout)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/scheduler.py", line 194, in start
    self.step()
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/scheduler.py", line 217, in step
    next(self._runner)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/scheduler.py", line 286, in wrapper
    subtask = next(parent)
  File "/opt/heat/lib/python2.7/site-packages/heat/engine/stack.py", line 1397, in update_task
    update_task)
UnboundLocalError: local variable 'update_task' referenced before assignment

I haven't found a way to reproduce it, but it's obvious that if an exception is encountered on the following lines:
https://github.com/openstack/heat/blob/a8bf5cd/heat/engine/stack.py#L1379-L1382

..then the following lines will throw the above exception
https://github.com/openstack/heat/blob/a8bf5cd/heat/engine/stack.py#L1422-L1423

Changed in heat:
assignee: nobody → Jason Dunsmore (jasondunsmore)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

Fix proposed to branch: master
Review: https://review.openstack.org/296798

Changed in heat:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to heat (master)

Reviewed: https://review.openstack.org/296798
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=4446b861f4b8f81ef4b41310b81b5a06a33b946a
Submitter: Jenkins
Branch: master

commit 4446b861f4b8f81ef4b41310b81b5a06a33b946a
Author: Jason Dunsmore <email address hidden>
Date: Wed Mar 23 15:12:46 2016 -0500

    Don't create an "update task" inside a try block

    The code inside the "except" block depends on the update_task variable
    that may not have been successfully assigned in the "try" block. Move
    that code out of the "try" block so the exception can bubble up
    instead of being obscured by a "local variable 'update_task'
    referenced before assignment" error.

    Change-Id: I88d6f13ee4365b1327ffc06c961600262396e066
    Closes-Bug: #1561066

Changed in heat:
status: In Progress → Fix Released
Changed in heat:
milestone: none → newton-1
importance: Undecided → Medium
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/heat 7.0.0.0b1

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

tags: added: mitaka-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/350313

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

Reviewed: https://review.openstack.org/350313
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=5ec7f127929418e17fc7b37dc9da5b5a29835256
Submitter: Jenkins
Branch: stable/mitaka

commit 5ec7f127929418e17fc7b37dc9da5b5a29835256
Author: Jason Dunsmore <email address hidden>
Date: Wed Mar 23 15:12:46 2016 -0500

    Don't create an "update task" inside a try block

    The code inside the "except" block depends on the update_task variable
    that may not have been successfully assigned in the "try" block. Move
    that code out of the "try" block so the exception can bubble up
    instead of being obscured by a "local variable 'update_task'
    referenced before assignment" error.

    Change-Id: I88d6f13ee4365b1327ffc06c961600262396e066
    Closes-Bug: #1561066
    (cherry picked from commit 4446b861f4b8f81ef4b41310b81b5a06a33b946a)

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/heat 6.1.0

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