py3 failure cfg.py - dictionary changed size during iteration

Bug #1796163 reported by Corey Bryant
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo.config
Fix Released
High
Corey Bryant
python-oslo.config (Ubuntu)
Fix Released
High
Unassigned
Cosmic
Fix Released
High
Unassigned

Bug Description

We came across the following issue while function testing keystone with py3: https://paste.ubuntu.com/p/d7s6KKPQDG/

  File "/usr/lib/python3/dist-packages/oslo_config/cfg.py", line 2652, in __iter__
    for key in itertools.chain(self._opts.keys(), self._groups.keys()):
RuntimeError: dictionary changed size during iteration

description: updated
description: updated
summary: - py3 failure
+ py3 failure cfg.py - dictionary changed size during iteration
Changed in python-oslo.config (Ubuntu Cosmic):
status: New → Triaged
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (master)

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

Changed in oslo.config:
assignee: nobody → Corey Bryant (corey.bryant)
status: New → In Progress
Revision history for this message
Corey Bryant (corey.bryant) wrote :

I went with a minimal fix on this. There are other uses of d.keys() in oslo.config but I'm not sure which ones modify the dictionary during iteration. Could change all uses to list(d.keys()) but that would somewhat defeat the purpose of the PEP.

Ben Nemec (bnemec)
Changed in oslo.config:
importance: Undecided → High
Revision history for this message
Ben Nemec (bnemec) wrote :

Weird. This code doesn't seem like it would alter the opts. Is it possible that another thread registered an opt on the config object during the iteration?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-oslo.config - 1:6.4.0-0ubuntu2

---------------
python-oslo.config (1:6.4.0-0ubuntu2) cosmic; urgency=medium

  * d/p/py3-ensure-iter-list.patch: Ensure ConfigOpts __iter__ uses
    list(d.keys()) as d.keys() no longer returns a copy of keys in py3
    (LP: #1796163).

 -- Corey Bryant <email address hidden> Thu, 04 Oct 2018 15:52:48 -0400

Changed in python-oslo.config (Ubuntu Cosmic):
status: Triaged → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to oslo.config (stable/rocky)

Fix proposed to branch: stable/rocky
Review: https://review.openstack.org/608235

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (master)

Reviewed: https://review.openstack.org/608064
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=7ad146c48791bebee12fbdcdb1ac2427237343c3
Submitter: Zuul
Branch: master

commit 7ad146c48791bebee12fbdcdb1ac2427237343c3
Author: Corey Bryant <email address hidden>
Date: Thu Oct 4 15:29:36 2018 -0400

    python3: Ensure ConfigOpts __iter__ uses list(d.keys())

    d.keys() no longer returns a copy of the keys in Python 3.
    This is part of PEP 3106.

    Change-Id: Ie4897109c87d6dc2952c2eb35b83fe368fb31803
    Closes-Bug: #1796163

Changed in oslo.config:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.config 6.6.0

This issue was fixed in the openstack/oslo.config 6.6.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo.config (stable/rocky)

Reviewed: https://review.openstack.org/608235
Committed: https://git.openstack.org/cgit/openstack/oslo.config/commit/?id=1884c307a9502393d275e0d5c5b2e56343792908
Submitter: Zuul
Branch: stable/rocky

commit 1884c307a9502393d275e0d5c5b2e56343792908
Author: Corey Bryant <email address hidden>
Date: Thu Oct 4 15:29:36 2018 -0400

    python3: Ensure ConfigOpts __iter__ uses list(d.keys())

    d.keys() no longer returns a copy of the keys in Python 3.
    This is part of PEP 3106.

    Change-Id: Ie4897109c87d6dc2952c2eb35b83fe368fb31803
    Closes-Bug: #1796163

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/oslo.config 6.4.1

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