Segfaults with dict

Bug #1711724 reported by Clint Byrum on 2017-08-18
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python3.5 (Ubuntu)
Undecided
Unassigned
Xenial
High
Clint Byrum
Zesty
High
Clint Byrum
python3.6 (Ubuntu)
Undecided
Unassigned
Xenial
Undecided
Unassigned
Zesty
High
Clint Byrum

Bug Description

In certain situations python3.5 will segfault. This bug is confirmed and fixed upstream in Python 3.5.4

http://bugs.python.org/issue27945

[Test Case]
1. download attached bpo-27945.py
2. run: python3.5 bpo-27945.py

If it does not segfault, the bug is fixed.

[Regression Potential]
The fix has been shown to introduce a minor performance hit for dictionaries in general.

Monty Taylor (mordred) wrote :

Patch to apply fix for bpo-27945 to 3.5.2.

Clint Byrum (clint-fewbar) wrote :

This python script reproduces the segfault when run via python3.5

description: updated
Changed in python3.5 (Ubuntu):
status: New → Invalid
Clint Byrum (clint-fewbar) wrote :

Python3.5 has been removed from artful, and thus does not need to be fixed.

Changed in python3.6 (Ubuntu):
status: New → Fix Released
Changed in python3.6 (Ubuntu Xenial):
status: New → Invalid
Clint Byrum (clint-fewbar) wrote :

The attached patch is also included in Python 3.6.2 upstream, which is released in artful.

Monty Taylor (mordred) wrote :

The quilt patch (and upstream bugfix) adds unit test test_fromkeys_operator_modifying_dict_operand which demonstrate a reproducer which has been verified to fail on xenial 3.5.2 and to work after applying the patch.

Changed in python3.5 (Ubuntu Xenial):
status: New → In Progress
assignee: nobody → Clint Byrum (clint-fewbar)
Changed in python3.5 (Ubuntu Xenial):
importance: Undecided → High

An upload of python3.5 to xenial-proposed has been rejected from the upload queue for the following reason: "Bug# 1682934 is missing SRU testcase/impact/regresison potential; all bugs are missing a Zesty upload which is requried before we could release the Xenial update.".

Clint Byrum (clint-fewbar) wrote :

Uploaded for zesty as well.

Changed in python3.5 (Ubuntu Zesty):
assignee: nobody → Clint Byrum (clint-fewbar)
importance: Undecided → High
status: New → In Progress
Clint Byrum (clint-fewbar) wrote :

I've uploaded just this fix to xenial and zesty, without the other bug which isn't SRU-ready yet. Thanks for your review raof!

Clint Byrum (clint-fewbar) wrote :

Uploaded to python3.6 for zesty too.

Changed in python3.6 (Ubuntu Zesty):
status: New → In Progress
importance: Undecided → High
assignee: nobody → Clint Byrum (clint-fewbar)

Hello Clint, or anyone else affected,

Accepted python3.6 into zesty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python3.6/3.6.1-1ubuntu0~17.04.0 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-zesty to verification-done-zesty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-zesty. 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!

Changed in python3.6 (Ubuntu Zesty):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-zesty
Changed in python3.5 (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed-xenial
Brian Murray (brian-murray) wrote :

Hello Clint, or anyone else affected,

Accepted python3.5 into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python3.5/3.5.2-2ubuntu0~16.04.2 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-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. 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!

Simon Déziel (sdeziel) wrote :

On Xenial, before:

$ python3.5 bpo-27945.py
Segmentation fault

After applying 3.5.2-2ubuntu0~16.04.2:

$ python3.5 bpo-27945.py
Traceback (most recent call last):
  File "bpo-27945.py", line 7, in <module>
    for result in d.items():
RuntimeError: dictionary changed size during iteration

tags: added: verification-done-xenial
removed: verification-needed-xenial
Simon Déziel (sdeziel) wrote :

On Zesty, before with python3.6:

$ python3.6 /tmp/bpo-27945.py
Segmentation fault

After applying 3.6.1-1ubuntu0~17.04.0:

$ python3.6 /tmp/bpo-27945.py
Traceback (most recent call last):
  File "/tmp/bpo-27945.py", line 7, in <module>
    for result in d.items():
RuntimeError: dictionary changed size during iteration
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/tmp/bpo-27945.py", line 7, in <module>
    for result in d.items():
RuntimeError: dictionary changed size during iteration

The except hook error is unrelated.

Brian Murray (brian-murray) wrote :

Hello Clint, or anyone else affected,

Accepted python3.5 into zesty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/python3.5/3.5.3-1ubuntu0~17.04.0 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-zesty to verification-done-zesty. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-zesty. 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!

Changed in python3.5 (Ubuntu Zesty):
status: In Progress → Fix Committed
Simon Déziel (sdeziel) wrote :

On Zesty, before with python3.5:

$ python3.5 /tmp/bpo-27945.py
Segmentation fault

After applying 3.5.3-1ubuntu0~17.04.0:

$ python3.5 /tmp/bpo-27945.py
Traceback (most recent call last):
  File "/tmp/bpo-27945.py", line 7, in <module>
    for result in d.items():
RuntimeError: dictionary changed size during iteration

tags: added: verification-done verification-done-zesty
removed: verification-needed verification-needed-zesty
Łukasz Zemczak (sil2100) wrote :

The xenial upload looks good. I'll be accepting it once I release the previous python3.5 package that's in -proposed (I'll do that on Monday since Friday releases to -updates are never a good idea).

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python3.6 - 3.6.1-1ubuntu0~17.04.0

---------------
python3.6 (3.6.1-1ubuntu0~17.04.0) zesty; urgency=medium

  * SRU: LP: #1711724 Fix dict segfault. Issue #27945.

 -- Clint Byrum <email address hidden> Thu, 07 Sep 2017 09:36:03 -0700

Changed in python3.6 (Ubuntu Zesty):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for python3.6 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.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python3.5 - 3.5.3-1ubuntu0~17.04.0

---------------
python3.5 (3.5.3-1ubuntu0~17.04.0) zesty; urgency=medium

  * SRU: LP: #1711724 Fix dict segfault. Issue #27945.

 -- Clint Byrum <email address hidden> Thu, 07 Sep 2017 09:23:57 -0700

Changed in python3.5 (Ubuntu Zesty):
status: Fix Committed → Fix Released
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python3.5 - 3.5.2-2ubuntu0~16.04.2

---------------
python3.5 (3.5.2-2ubuntu0~16.04.2) xenial; urgency=medium

  * SRU: LP: #1711724 Fix dict segfault. Issue #27945.

 -- Clint Byrum <email address hidden> Fri, 18 Aug 2017 10:48:00 -0700

Changed in python3.5 (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers