[SRU] Infinite recursion in Python 3

Bug #1800601 reported by Thomas Goirand
18
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Undecided
Unassigned
Ubuntu Cloud Archive
Fix Released
Critical
Unassigned
Rocky
Fix Released
Critical
Unassigned
glance (Ubuntu)
Fix Released
Critical
Unassigned
Cosmic
Fix Released
Critical
Unassigned
Disco
Fix Released
Critical
Unassigned

Bug Description

Hi,

When running unit tests under Python 3.7 when building the Rocky Debian package in Sid, I get a never ending recursion. Please see the Debian bug report:

https://bugs.debian.org/911947

Basically, it's this:

| File "/build/1st/glance-17.0.0/glance/domain/__init__.py", line 316, in keys
| return dict(self).keys()
| File "/build/1st/glance-17.0.0/glance/domain/__init__.py", line 316, in keys
| return dict(self).keys()
| File "/build/1st/glance-17.0.0/glance/domain/__init__.py", line 316, in keys
| return dict(self).keys()
| RecursionError: maximum recursion depth exceeded while calling a Python object

== Ubuntu SRU details ==

[Impact]
An infinite recursion error occurs when running Python 3.6 glance from rocky. This issue has also been seen when running python 3.7 unit tests.
The error has also been seen in a Rocky deployment and causes the glance api service to return 500 errors.

[Test Case]
Bionic (cloud-archive): Deploy the glance charm on bionic then upgrade it to rocky by updating the openstack-origin to cloud:bionic-rocky/proposed
Cosmic: Note that for cosmic we don't have the ability to test an upgrade from queens to rocky like we can on bionic so we'll just manually test the python3 code.

[Regression Potential]
Fairly low. The patch is a minimal fix and will be fully exercised by the OpenStack charms team.

Changed in glance:
status: New → Confirmed
Revision history for this message
Abhishek Kekane (abhishek-kekane) wrote :

Around 291 tests fails with python version 3.7.1, everything works with python 3.7.0 and less.

Initial observation is while converting object to dict [1] it again calls keys method which causes the recursion. If I try to change the code to avoid conversion to dict then 20 tests fails. Need to find some workaround, may be we need some expert opinion here.

[1] https://github.com/openstack/glance/blob/master/glance/domain/__init__.py#L316

Note:
If I remove entire keys function from above line, around 20-40 tests fails for all python versions.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

This will be this change https://bugs.python.org/issue34320 I assume. I don't really understand what that class is trying to achieve (how does it differ in behaviour from a regular dictionary?) but I guess if you say dict(self.items()).keys() instead it will probably work...

Revision history for this message
Thomas Goirand (thomas-goirand) wrote :

After this change suggested by Michael, there's no infinite recursion, though there's still 43 unit test failures (which seem related to this problem).

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

Reviewed: https://review.openstack.org/615124
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=43587fb93d8d949d9a9895153ac06ea4e7e6d150
Submitter: Zuul
Branch: master

commit 43587fb93d8d949d9a9895153ac06ea4e7e6d150
Author: James Page <email address hidden>
Date: Fri Nov 2 10:10:49 2018 +0000

    py3: fix recursion issue under py37

    Add tox target and resolve issue with infinite recursion in
    ExtraProperties class by directly using methods on the dict
    class.

    Closes-Bug: 1800601

    Change-Id: Ie98c4287c8bd1c364655adb99c7a88d1d451496e

Changed in glance:
status: Confirmed → Fix Released
Revision history for this message
Thomas Goirand (thomas-goirand) wrote : Re: Unit test infinit recursion in Python 3.7

FYI, the patch from James Page fixes my problem.

Revision history for this message
Liam Young (gnuoy) wrote :

I'm seeing this with Rocky on Bionic using python 3.6.7. (fwiw it was after an upgrade from Queens). James' patch fixes it for me too.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/rocky)

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

Changed in glance (Ubuntu Cosmic):
status: New → Triaged
importance: Undecided → Critical
Changed in glance (Ubuntu Disco):
status: New → Triaged
importance: Undecided → Critical
summary: - Unit test infinit recursion in Python 3.7
+ [SRU] Infinite recursion in Python 3
Revision history for this message
Liam Young (gnuoy) wrote :

Just to be clear, when I say I'm hitting it I mean I'm hitting it on a deployed system, not just in unit tests.

description: updated
Liam Young (gnuoy)
description: updated
Revision history for this message
Corey Bryant (corey.bryant) wrote :

The patched version of glance for rocky has been uploaded to the cosmic unapproved queue: https://launchpad.net/ubuntu/cosmic/+queue?queue_state=1&queue_text=

Revision history for this message
Timo Aaltonen (tjaalton) wrote : Please test proposed package

Hello Thomas, or anyone else affected,

Accepted glance into cosmic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/glance/2:17.0.0-0ubuntu4.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-cosmic to verification-done-cosmic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-cosmic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in glance (Ubuntu Cosmic):
status: Triaged → Fix Committed
tags: added: verification-needed verification-needed-cosmic
Changed in cloud-archive:
status: Triaged → Fix Committed
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Hello Thomas, or anyone else affected,

Accepted glance into rocky-proposed. The package will build now and be available in the Ubuntu Cloud Archive in a few hours, and then in the -proposed repository.

Please help us by testing this new package. To enable the -proposed repository:

  sudo add-apt-repository cloud-archive:rocky-proposed
  sudo apt-get update

Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-rocky-needed to verification-rocky-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-rocky-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-rocky-needed
description: updated
Revision history for this message
Corey Bryant (corey.bryant) wrote :

Verified successfully on cosmic: https://paste.ubuntu.com/p/DtTXZ2FYdW/

tags: added: verification-done-cosmic
removed: verification-needed-cosmic
Revision history for this message
Corey Bryant (corey.bryant) wrote :

This is fixed in disco in glance 2:18.0.0~b1~git20181108.97dac0f3-0ubuntu1.

Changed in glance (Ubuntu Disco):
status: Triaged → Fix Released
Revision history for this message
Liam Young (gnuoy) wrote :

I have successfully run the mojo spec which was failing (specs/full_stack/next_openstack_upgrade/queens). This boots an instance on rocky which indirectly queries glance: https://pastebin.canonical.com/p/7sVjF6QSNm/

tags: added: verification-rocky-done
removed: verification-rocky-needed
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for glance has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

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

This bug was fixed in the package glance - 2:17.0.0-0ubuntu4.1

---------------
glance (2:17.0.0-0ubuntu4.1) cosmic; urgency=medium

  * d/gbp.conf: Create stable/rocky branch.
  * d/p/fix-py3-recursion.patch: Cherry-picked from upstream master branch to
    fix error with infinite recursion under Python 3 (LP: #1800601).

 -- Corey Bryant <email address hidden> Wed, 31 Oct 2018 13:55:56 -0400

Changed in glance (Ubuntu Cosmic):
status: Fix Committed → Fix Released
Revision history for this message
Corey Bryant (corey.bryant) wrote :

This bug was fixed in the package glance - 2:17.0.0-0ubuntu4.1~cloud0
---------------

 glance (2:17.0.0-0ubuntu4.1~cloud0) bionic-rocky; urgency=medium
 .
   * New update for the Ubuntu Cloud Archive.
 .
 glance (2:17.0.0-0ubuntu4.1) cosmic; urgency=medium
 .
   * d/gbp.conf: Create stable/rocky branch.
   * d/p/fix-py3-recursion.patch: Cherry-picked from upstream master branch to
     fix error with infinite recursion under Python 3 (LP: #1800601).

Changed in cloud-archive:
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/rocky)

Reviewed: https://review.openstack.org/616639
Committed: https://git.openstack.org/cgit/openstack/glance/commit/?id=2bcd6c66629a06afdfcd32ff7892c5571bbe0573
Submitter: Zuul
Branch: stable/rocky

commit 2bcd6c66629a06afdfcd32ff7892c5571bbe0573
Author: James Page <email address hidden>
Date: Fri Nov 2 10:10:49 2018 +0000

    py3: fix recursion issue under py37

    Add tox target and resolve issue with infinite recursion in
    ExtraProperties class by directly using methods on the dict
    class.

    Closes-Bug: 1800601

    Change-Id: Ie98c4287c8bd1c364655adb99c7a88d1d451496e
    (cherry picked from commit 43587fb93d8d949d9a9895153ac06ea4e7e6d150)

tags: added: in-stable-rocky
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 18.0.0.0b1

This issue was fixed in the openstack/glance 18.0.0.0b1 development milestone.

Erno Kuvaja (jokke)
Changed in glance:
milestone: none → stein-1
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/glance 17.0.1

This issue was fixed in the openstack/glance 17.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.opendev.org/761938

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

Change abandoned by "Abhishek Kekane <email address hidden>" on branch: stable/queens
Review: https://review.opendev.org/c/openstack/glance/+/761938
Reason: This does not fit with our backport criteria [0]

[0] https://docs.openstack.org/project-team-guide/stable-branches.html#appropriate-fixes

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.