NUMATopologyFilter modifies the provided RequestSpec

Bug #1655979 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Medium
Stephen Finucane
Newton
Fix Committed
Low
Stephen Finucane

Bug Description

The 'NUMATopologyFilter' makes a call to 'numa_fit_instance_to_host' in order to determine whether an instance with a sample topology could fit on a given host. This function is provided with an InstanceNUMATopology object, which was extracted from the RequestSpec provided to the filter. However, the 'numa_fit_instance_to_host' call has the side effect of modifying a couple of fields on this InstanceNUMATopology object, notably the pinning information, which appears to be propagated to subsequent calls of the filter. The reason for this propagation is presumably Python's "call-by-object" model [1].

We should ensure the original RequestSpec is not modified, thus preventing possible issues in the future.

[1] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/

Tags: numa scheduler
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

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

Changed in nova:
assignee: nobody → Stephen Finucane (stephenfinucane)
status: New → In Progress
Matt Riedemann (mriedem)
Changed in nova:
importance: Undecided → Medium
tags: added: numa scheduler
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/419479
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=bff2030ecea8a1d21e03c61a7ece02f40dc25c5d
Submitter: Jenkins
Branch: master

commit bff2030ecea8a1d21e03c61a7ece02f40dc25c5d
Author: Stephen Finucane <email address hidden>
Date: Thu Jan 12 13:59:32 2017 +0000

    scheduler: Don't modify RequestSpec.numa_topology

    The 'NUMATopologyFilter' makes a call to 'numa_fit_instance_to_host' in
    order to determine whether an instance with a sample topology could fit
    on a given host. This function is provided with an InstanceNUMATopology
    object, which was extracted from the RequestSpec provided to the filter.
    However, the 'numa_fit_instance_to_host' call has the side effect of
    modifying a couple of fields on this InstanceNUMATopology object, most
    notably the pinning information, and these changes are then propagated
    to subsequent calls of the filter. The reason for this propagation is
    presumably Python's "call-by-object" model [1].

    While this doesn't cause any issues currently, it is a latent bug that
    has caused issues downstream. Resolve the issue by copying the entire
    RequestSpec object, thus ensuring any changes to this or the contained
    NUMA topology are not stored and cannot affect future calls to this or
    other filters.

    [1] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/

    Change-Id: If26cbdd5189c53891554c8d128be9b90578616aa
    Closes-Bug: #1655979

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

Fix proposed to branch: stable/newton
Review: https://review.openstack.org/425087

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 15.0.0.0b3

This issue was fixed in the openstack/nova 15.0.0.0b3 development milestone.

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

Reviewed: https://review.openstack.org/425087
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=2927ead260d90c44daeff4a1d4917043e5ed7c9d
Submitter: Jenkins
Branch: stable/newton

commit 2927ead260d90c44daeff4a1d4917043e5ed7c9d
Author: Stephen Finucane <email address hidden>
Date: Thu Jan 12 13:59:32 2017 +0000

    scheduler: Don't modify RequestSpec.numa_topology

    The 'NUMATopologyFilter' makes a call to 'numa_fit_instance_to_host' in
    order to determine whether an instance with a sample topology could fit
    on a given host. This function is provided with an InstanceNUMATopology
    object, which was extracted from the RequestSpec provided to the filter.
    However, the 'numa_fit_instance_to_host' call has the side effect of
    modifying a couple of fields on this InstanceNUMATopology object, most
    notably the pinning information, and these changes are then propagated
    to subsequent calls of the filter. The reason for this propagation is
    presumably Python's "call-by-object" model [1].

    While this doesn't cause any issues currently, it is a latent bug that
    has caused issues downstream. Resolve the issue by copying the entire
    RequestSpec object, thus ensuring any changes to this or the contained
    NUMA topology are not stored and cannot affect future calls to this or
    other filters.

    [1] https://jeffknupp.com/blog/2012/11/13/is-python-callbyvalue-or-callbyreference-neither/

    Conflicts:
      The 'zip' function must be wrapped in a 'list' to resolve a latent
      Python 3 issue.

    Change-Id: If26cbdd5189c53891554c8d128be9b90578616aa
    Closes-Bug: #1655979
    (cherry picked from commit bff2030ecea8a1d21e03c61a7ece02f40dc25c5d)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/nova 14.0.4

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