Failure trying to list stacks

Bug #1634127 reported by Thomas Herve
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
Medium
Thomas Herve

Bug Description

Got the following traceback during a test run:

Exception handling resource: 'NoneType' object has no attribute '__getitem__'
Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/server.py", line 133, in _process_incoming
    res = self.dispatcher.dispatch(message)

  File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 150, in dispatch
    return self._do_dispatch(endpoint, method, ctxt, args)

  File "/usr/local/lib/python2.7/dist-packages/oslo_messaging/rpc/dispatcher.py", line 121, in _do_dispatch
    result = func(ctxt, **new_args)

  File "/usr/local/lib/python2.7/dist-packages/osprofiler/profiler.py", line 154, in wrapper
    return f(*args, **kwargs)

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

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

  File "/opt/stack/new/heat/heat/objects/stack.py", line 135, in get_all
    yield cls._from_db_object(context, cls(context), db_stack)

  File "/opt/stack/new/heat/heat/objects/stack.py", line 73, in _from_db_object
    db_stack['raw_template']))

  File "/opt/stack/new/heat/heat/objects/raw_template.py", line 57, in from_db_object
    tpl[field] = db_tpl[field]

I believe that now that we removed the automatic eager loading, we need to take care of None values in that field.
TypeError: 'NoneType' object has no attribute '__getitem__'

Thomas Herve (therve)
Changed in heat:
assignee: nobody → Zane Bitter (zaneb)
Revision history for this message
Zane Bitter (zaneb) wrote :

I gather from IRC that this occurred at roughly the same time as the purge test was running. So it's possible that between the time we are loading the stack and when we are loading the raw_template, the raw_template has been deleted.

The bigger issue here though is that we are loading the raw_template at all. The whole point of not eager-loading is that we don't actually need it for such operations as stack-list, but in fact we load it anyway (now using a separate DB query, so the worst of both worlds) just by virtue of using the versioned object interface (sadly, another example of how versioned objects make everything worse without providing any useful abstraction):

http://git.openstack.org/cgit/openstack/heat/tree/heat/objects/stack.py?h=stable%2Fnewton#n70

We need to either find some way to make the versioned object lazily-load the template, or failing that revert the non-eager-loading patch so that we continue to take the memory/bandwidth hit but at least don't split the loading into two queries.

Removing myself as assignee because I'm unlikely to have time to look at this this week.

Changed in heat:
assignee: Zane Bitter (zaneb) → nobody
status: New → Triaged
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/388188

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

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

commit c59865870bc8cdd9dbdbaace11b5a0af48f93130
Author: Thomas Herve <email address hidden>
Date: Tue Oct 18 21:37:49 2016 +0200

    Don't query raw_template in stacks uselessly

    When partially removing eager loading of raw_template in stacks
    (260b79ed28b5dc48f70fe77dfdfc074991ad1e99), we didn't get into account
    that accessing the sqlalchemy field would create an additional query
    whereas it was previously eager loaded. This removes it by only filling
    the field when it's already fetched.

    Change-Id: Ifa17c74e3559adaef56593a205101d92e9a37da5
    Closes-Bug: #1634127

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

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

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.