The object is unhashable when inheriting the class ComparableVersionedObject

Bug #1687592 reported by Guoshuai Li
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.versionedobjects
Fix Released
Undecided
Guoshuai Li

Bug Description

In python3.5, The Port object List conver to set is error:

2017-04-28 06:58:02.967886 | 2017-04-28 06:58:02.967 | Captured pythonlogging:
2017-04-28 06:58:02.970360 | 2017-04-28 06:58:02.969 | ~~~~~~~~~~~~~~~~~~~~~~~
2017-04-28 06:58:02.972859 | 2017-04-28 06:58:02.972 | b' ERROR [neutron.api.v2.resource] update failed: No details.'
2017-04-28 06:58:02.975292 | 2017-04-28 06:58:02.974 | b'Traceback (most recent call last):'
2017-04-28 06:58:02.977856 | 2017-04-28 06:58:02.977 | b' File "/opt/stack/new/neutron/neutron/api/v2/resource.py", line 79, in resource'
2017-04-28 06:58:02.980193 | 2017-04-28 06:58:02.979 | b' result = method(request=request, **args)'
2017-04-28 06:58:02.982602 | 2017-04-28 06:58:02.982 | b' File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 615, in update'
2017-04-28 06:58:02.985211 | 2017-04-28 06:58:02.984 | b' return self._update(request, id, body, **kwargs)'
2017-04-28 06:58:02.987729 | 2017-04-28 06:58:02.987 | b' File "/opt/stack/new/neutron/neutron/db/api.py", line 94, in wrapped'
2017-04-28 06:58:02.990103 | 2017-04-28 06:58:02.989 | b" setattr(e, '_RETRY_EXCEEDED', True)"
2017-04-28 06:58:02.992836 | 2017-04-28 06:58:02.992 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 220, in __exit__'
2017-04-28 06:58:02.995602 | 2017-04-28 06:58:02.995 | b' self.force_reraise()'
2017-04-28 06:58:02.998386 | 2017-04-28 06:58:02.997 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 196, in force_reraise'
2017-04-28 06:58:03.001007 | 2017-04-28 06:58:03.000 | b' six.reraise(self.type_, self.value, self.tb)'
2017-04-28 06:58:03.003458 | 2017-04-28 06:58:03.002 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/six.py", line 686, in reraise'
2017-04-28 06:58:03.005995 | 2017-04-28 06:58:03.005 | b' raise value'
2017-04-28 06:58:03.008581 | 2017-04-28 06:58:03.008 | b' File "/opt/stack/new/neutron/neutron/db/api.py", line 90, in wrapped'
2017-04-28 06:58:03.011076 | 2017-04-28 06:58:03.010 | b' return f(*args, **kwargs)'
2017-04-28 06:58:03.013534 | 2017-04-28 06:58:03.013 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_db/api.py", line 150, in wrapper'
2017-04-28 06:58:03.016253 | 2017-04-28 06:58:03.015 | b' ectxt.value = e.inner_exc'
2017-04-28 06:58:03.019239 | 2017-04-28 06:58:03.018 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 220, in __exit__'
2017-04-28 06:58:03.021866 | 2017-04-28 06:58:03.021 | b' self.force_reraise()'
2017-04-28 06:58:03.024551 | 2017-04-28 06:58:03.023 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 196, in force_reraise'
2017-04-28 06:58:03.027108 | 2017-04-28 06:58:03.026 | b' six.reraise(self.type_, self.value, self.tb)'
2017-04-28 06:58:03.029843 | 2017-04-28 06:58:03.029 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/six.py", line 686, in reraise'
2017-04-28 06:58:03.032453 | 2017-04-28 06:58:03.031 | b' raise value'
2017-04-28 06:58:03.035032 | 2017-04-28 06:58:03.034 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_db/api.py", line 138, in wrapper'
2017-04-28 06:58:03.037594 | 2017-04-28 06:58:03.037 | b' return f(*args, **kwargs)'
2017-04-28 06:58:03.040226 | 2017-04-28 06:58:03.039 | b' File "/opt/stack/new/neutron/neutron/db/api.py", line 129, in wrapped'
2017-04-28 06:58:03.042677 | 2017-04-28 06:58:03.042 | b' LOG.debug("Retry wrapper got retriable exception: %s", e)'
2017-04-28 06:58:03.045532 | 2017-04-28 06:58:03.044 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 220, in __exit__'
2017-04-28 06:58:03.048051 | 2017-04-28 06:58:03.047 | b' self.force_reraise()'
2017-04-28 06:58:03.050609 | 2017-04-28 06:58:03.050 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/oslo_utils/excutils.py", line 196, in force_reraise'
2017-04-28 06:58:03.053137 | 2017-04-28 06:58:03.052 | b' six.reraise(self.type_, self.value, self.tb)'
2017-04-28 06:58:03.055661 | 2017-04-28 06:58:03.055 | b' File "/opt/stack/new/networking-ovn/.tox/dsvm-functional-py35/lib/python3.5/site-packages/six.py", line 686, in reraise'
2017-04-28 06:58:03.058444 | 2017-04-28 06:58:03.057 | b' raise value'
2017-04-28 06:58:03.061034 | 2017-04-28 06:58:03.060 | b' File "/opt/stack/new/neutron/neutron/db/api.py", line 125, in wrapped'
2017-04-28 06:58:03.063661 | 2017-04-28 06:58:03.063 | b' return f(*dup_args, **dup_kwargs)'
2017-04-28 06:58:03.066243 | 2017-04-28 06:58:03.065 | b' File "/opt/stack/new/neutron/neutron/api/v2/base.py", line 663, in _update'
2017-04-28 06:58:03.068816 | 2017-04-28 06:58:03.068 | b' obj = obj_updater(request.context, id, **kwargs)'
2017-04-28 06:58:03.071415 | 2017-04-28 06:58:03.070 | b' File "/opt/stack/new/neutron/neutron/extensions/qos.py", line 300, in <lambda>'
2017-04-28 06:58:03.073942 | 2017-04-28 06:58:03.073 | b' method_name, rule_cls, *args, **kwargs)'
2017-04-28 06:58:03.076516 | 2017-04-28 06:58:03.075 | b' File "/opt/stack/new/neutron/neutron/extensions/qos.py", line 296, in _make_call'
2017-04-28 06:58:03.079103 | 2017-04-28 06:58:03.078 | b' context, rule_cls, *args_list, **params'
2017-04-28 06:58:03.081578 | 2017-04-28 06:58:03.081 | b' File "/opt/stack/new/neutron/neutron/db/db_base_plugin_common.py", line 44, in inner'
2017-04-28 06:58:03.084093 | 2017-04-28 06:58:03.083 | b' result = f(*args, **kwargs)'
2017-04-28 06:58:03.086637 | 2017-04-28 06:58:03.086 | b' File "/opt/stack/new/neutron/neutron/services/qos/qos_plugin.py", line 327, in update_policy_rule'
2017-04-28 06:58:03.089150 | 2017-04-28 06:58:03.088 | b' self.validate_policy(context, policy)'
2017-04-28 06:58:03.091737 | 2017-04-28 06:58:03.091 | b' File "/opt/stack/new/neutron/neutron/services/qos/qos_plugin.py", line 131, in validate_policy'
2017-04-28 06:58:03.094220 | 2017-04-28 06:58:03.093 | b' ports = self._get_ports_with_policy(context, policy)'
2017-04-28 06:58:03.096775 | 2017-04-28 06:58:03.096 | b' File "/opt/stack/new/neutron/neutron/services/qos/qos_plugin.py", line 76, in _get_ports_with_policy'
2017-04-28 06:58:03.099268 | 2017-04-28 06:58:03.098 | b' return list(set(ports_with_policy + ports_with_net_policy))'
2017-04-28 06:58:03.101796 | 2017-04-28 06:58:03.101 | b"TypeError: unhashable type: 'Port'"
2017-04-28 06:58:03.104226 | 2017-04-28 06:58:03.103 | b' WARNING [neutron.quota.resource] No sqlalchemy event for resource port found'
2017-04-28 06:58:03.107000 | 2017-04-28 06:58:03.106 | b' WARNING [neutron.quota.resource] No sqlalchemy event for resource network found'
2017-04-28 06:58:03.109871 | 2017-04-28 06:58:03.109 | b' WARNING [neutron.quota.resource] No sqlalchemy event for resource subnet found'
2017-04-28 06:58:03.112651 | 2017-04-28 06:58:03.112 | b' WARNING [neutron.quota.resource] No sqlalchemy event for resource subnetpool found'
2017-04-28 06:58:03.115098 | 2017-04-28 06:58:03.114 | b''
2017-04-28 06:58:03.117778 | 2017-04-28 06:58:03.117 |

Changed in oslo.versionedobjects:
assignee: nobody → Guoshuai Li (liguoshuai1990)
Revision history for this message
Slawek Kaplonski (slaweq) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.versionedobjects (master)

Reviewed: https://review.openstack.org/461726
Committed: https://git.openstack.org/cgit/openstack/oslo.versionedobjects/commit/?id=c4d7b10e5cca4c0eeba3244353173d973d3bb031
Submitter: Jenkins
Branch: master

commit c4d7b10e5cca4c0eeba3244353173d973d3bb031
Author: Guoshuai Li <email address hidden>
Date: Tue May 2 18:38:36 2017 +0800

    Fix the object is unhashable when inheriting the class
    "ComparableVersionedObject"

    In python3, A class that overrides __eq__() and does not define
    "__hash__()" will have its __hash__() implicitly set to None.
    This will cause the set method to unhashable failed.
    https://docs.python.org/3/reference/datamodel.html#object.__hash__

    Change-Id: I21685303e9bd233241b7b4216e3feb7bdaecc0a4
    Closes-Bug: #1687592

Changed in oslo.versionedobjects:
status: New → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.versionedobjects 1.26.0

This issue was fixed in the openstack/oslo.versionedobjects 1.26.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.