Stack listing is returning NotFound

Bug #1508390 reported by Thomas Herve
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Thomas Herve

Bug Description

Seen on this jenkins build: http://logs.openstack.org/04/237404/4/check/gate-heat-dsvm-functional-orig-mysql/854dd10/

test_stack_tags.StackTagTest.test_hidden_stack fails with a NotFound error when trying to list the stacks.

Looking in the agent, we get the following traceback:

Traceback (most recent call last):

  File "/opt/stack/new/heat/heat/common/context.py", line 293, in wrapped
    return func(self, ctx, *args, **kwargs)

  File "/opt/stack/new/heat/heat/engine/service.py", line 516, in list_stacks
    return [api.format_stack(stack) for stack in stacks]

  File "/opt/stack/new/heat/heat/engine/stack.py", line 403, in load_all
    not_tags_any) or []

  File "/opt/stack/new/heat/heat/objects/stack.py", line 122, in get_all
    db_stacks)

  File "/opt/stack/new/heat/heat/objects/stack.py", line 121, in <lambda>
    db_stack),

  File "/opt/stack/new/heat/heat/objects/stack.py", line 69, in _from_db_object
    context, db_stack['raw_template_id']))

  File "/opt/stack/new/heat/heat/objects/raw_template.py", line 67, in get_by_id
    raw_template_db = db_api.raw_template_get(context, template_id)

  File "/opt/stack/new/heat/heat/db/api.py", line 46, in raw_template_get
    return IMPL.raw_template_get(context, template_id)

  File "/opt/stack/new/heat/heat/db/sqlalchemy/api.py", line 102, in raw_template_get
    template_id)

NotFound: raw template with id 1869 not found

I think there may be a race condition with other commands, like it's trying to load a stack which just got its template removed. It may be related to bug #1506077.

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/238106

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

Reviewed: https://review.openstack.org/238106
Committed: https://git.openstack.org/cgit/openstack/heat/commit/?id=68bf3fcaad0fbaa932c719ce587266276a9cdd55
Submitter: Jenkins
Branch: master

commit 68bf3fcaad0fbaa932c719ce587266276a9cdd55
Author: Thomas Herve <email address hidden>
Date: Wed Oct 21 16:00:08 2015 +0200

    Fix race condition in stack listing

    When listing stacks, we first load them from the database, and then we
    load their template in a different transaction. If a stack is deleted in
    the mean time, loading the template will raise a NotFound exception, and
    will make the listing returns NotFound, instead of ignoring that stack.
    This patch handles the exception and continue to try to load stacks.

    Change-Id: Iba6db81e3c10310955928fe723b84b5f62fc3fc1
    Closes-Bug: #1508390

Changed in heat:
status: In Progress → Fix Committed
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/heat 6.0.0.0b1

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

Changed in heat:
status: Fix Committed → Fix Released
tags: added: liberty-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (stable/liberty)

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/253297

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

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/253299

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (stable/liberty)

Change abandoned by huangtianhua (<email address hidden>) on branch: stable/liberty
Review: https://review.openstack.org/253297

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on heat (stable/kilo)

Change abandoned by huangtianhua (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/253299

Revision history for this message
huangtianhua (huangtianhua) wrote :

Seems kilo and liberty are ok.

tags: removed: kilo-backport-potential liberty-backport-potentia
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.