Bug 1408282
| Summary: | TypeError: can't pickle _ped.Alignment objects | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Adam Williamson <awilliam> | ||||||||||||||||||||||||||||||
| Component: | python-blivet | Assignee: | Blivet Maintenance Team <blivet-maint-list> | ||||||||||||||||||||||||||||||
| Status: | CLOSED EOL | QA Contact: | Fedora Extras Quality Assurance <extras-qa> | ||||||||||||||||||||||||||||||
| Severity: | unspecified | Docs Contact: | |||||||||||||||||||||||||||||||
| Priority: | unspecified | ||||||||||||||||||||||||||||||||
| Version: | 26 | CC: | anaconda-maint-list, bcl, blivet-maint-list, dcantrell, g.kaviyarasu, jonathan, mkolman, robatino, vanmeeuwen+fedora, vponcova | ||||||||||||||||||||||||||||||
| Target Milestone: | --- | ||||||||||||||||||||||||||||||||
| Target Release: | --- | ||||||||||||||||||||||||||||||||
| Hardware: | x86_64 | ||||||||||||||||||||||||||||||||
| OS: | Unspecified | ||||||||||||||||||||||||||||||||
| Whiteboard: | abrt_hash:1c82ba3dcff5ed19fe6d5d583c68af45a98087f0a5e356550932f404302dccf0; | ||||||||||||||||||||||||||||||||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |||||||||||||||||||||||||||||||
| Doc Text: | Story Points: | --- | |||||||||||||||||||||||||||||||
| Clone Of: | Environment: | ||||||||||||||||||||||||||||||||
| Last Closed: | 2018-05-29 12:00:07 UTC | Type: | --- | ||||||||||||||||||||||||||||||
| Regression: | --- | Mount Type: | --- | ||||||||||||||||||||||||||||||
| Documentation: | --- | CRM: | |||||||||||||||||||||||||||||||
| Verified Versions: | Category: | --- | |||||||||||||||||||||||||||||||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |||||||||||||||||||||||||||||||
| Cloudforms Team: | --- | Target Upstream Version: | |||||||||||||||||||||||||||||||
| Embargoed: | |||||||||||||||||||||||||||||||||
| Attachments: |
|
||||||||||||||||||||||||||||||||
Created attachment 1234825 [details]
File: anaconda-tb
Created attachment 1234826 [details]
File: anaconda.log
Created attachment 1234827 [details]
File: dnf.librepo.log
Created attachment 1234828 [details]
File: environ
Created attachment 1234829 [details]
File: hawkey.log
Created attachment 1234830 [details]
File: lsblk_output
Created attachment 1234831 [details]
File: lvm.log
Created attachment 1234832 [details]
File: nmcli_dev_list
Created attachment 1234833 [details]
File: os_info
Created attachment 1234834 [details]
File: storage.log
Created attachment 1234835 [details]
File: syslog
Created attachment 1234836 [details]
File: ifcfg.log
Created attachment 1234837 [details]
File: packaging.log
Created attachment 1234838 [details]
File: program.log
Looks to be in blivet. Looks like a clear F26 Alpha blocker. So yeah, this definitely looks like a Python 3.6 change. Python 3.5 could pickle parted.alignment.Alignment instances just fine:
[root@adam src (master)]# python3
Python 3.5.2 (default, Dec 5 2016, 15:47:18)
[GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import parted.device
>>> dev = parted.device.Device('/dev/sda')
>>> al = dev.optimumAlignment
>>> import pickle
>>> pickle.dumps(al)
b'\x80\x03cparted.alignment\nAlignment\nq\x00)\x81q\x01}q\x02X\x15\x00\x00\x00_Alignment__alignmentq\x03c_ped\nAlignment\nq\x04)\x81q\x05sb.'
but it doesn't look like 3.6 can. Not sure if this is an intentional change. Will have a look.
Oh dear. I think we're in C here. A diff between Python 3.5 and Python 3.6 shows this code in Objects/typeobject.c that's in 3.6 but not 3.5:
@@ -3887,6 +3942,24 @@ _PyObject_GetState(PyObject *obj, int required)
}
assert(slotnames == Py_None || PyList_Check(slotnames));
+ if (required) {
+ Py_ssize_t basicsize = PyBaseObject_Type.tp_basicsize;
+ if (obj->ob_type->tp_dictoffset)
+ basicsize += sizeof(PyObject *);
+ if (obj->ob_type->tp_weaklistoffset)
+ basicsize += sizeof(PyObject *);
+ if (slotnames != Py_None)
+ basicsize += sizeof(PyObject *) * Py_SIZE(slotnames);
+ if (obj->ob_type->tp_basicsize > basicsize) {
+ Py_DECREF(slotnames);
+ Py_DECREF(state);
+ PyErr_Format(PyExc_TypeError,
+ "can't pickle %.200s objects",
+ Py_TYPE(obj)->tp_name);
+ return NULL;
+ }
+ }
+
if (slotnames != Py_None && Py_SIZE(slotnames) > 0) {
PyObject *slots;
Py_ssize_t slotnames_size, i;
which seems like an obvious suspect...
The message on the commit that added that check says:
Issue #22995: Instances of extension types with a state that aren't
subclasses of list or dict and haven't implemented any pickle-related
methods (__reduce__, __reduce_ex__, __getnewargs__, __getnewargs_ex__,
or __getstate__), can no longer be pickled. Including memoryview.
It references https://bugs.python.org/issue22995 , where there's some discussion that's probably illuminating to someone who's better at C than me. I *think* we need to do some work in pyparted here to make the extension types in _ped pickle-compatible, but...I might be missing something. Definitely seems a bit beyond me!
In fact, I found a way to attack this from the blivet end - it seems blivet already knew that it would have trouble trying to deepcopy some pyparted objects, and has some custom __deepcopy__ methods which shallow copy known-problematic things, but the list of things to shallow copy was missing (at least) one item. https://github.com/rhinstaller/blivet/pull/530 fixes things sufficiently for an install to run, for me. https://www.happyassassin.net/updates/1408282.0.img is an updates image with that fix. Adam told me on IRC that he might have found a solution (involving changing it so pickling _ped.Alignment is not required). If that doesn't work, you can do this to pickle it: # python3 Python 3.6.0rc1 (default, Dec 10 2016, 14:50:33) [GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import parted.device >>> dev = parted.device.Device('/dev/sda') >>> al = dev.optimumAlignment >>> import pickle >>> pickle.dumps(al) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can't pickle _ped.Alignment objects >>> import copyreg >>> from parted.device import _ped >>> def pickle_alignment(instance): ... return _ped.Alignment, (instance.offset, instance.grain_size) ... >>> copyreg.pickle(_ped.Alignment, pickle_alignment) >>> pickle.dumps(al) b'\x80\x03cparted.alignment\nAlignment\nq\x00)\x81q\x01}q\x02X\x15\x00\x00\x00_Alignment__alignmentq\x03c_ped\nAlignment\nq\x04K\x00K\x00\x86q\x05Rq\x06sb.' >>> I've now sent a downstream-patched Rawhide build, but perhaps we'd best leave this open for tracking to make sure the patch gets merged upstream and isn't lost from future builds. As this is addressed in the package, dropping the blocker status for now; if anything unexpected happens we can add it again. This bug appears to have been reported against 'rawhide' during the Fedora 26 development cycle. Changing version to '26'. This message is a reminder that Fedora 26 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 26. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as EOL if it remains open with a Fedora 'version' of '26'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version. Thank you for reporting this issue and we are sorry that we were not able to fix it before Fedora 26 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior this bug is closed as described in the policy above. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. Fedora 26 changed to end-of-life (EOL) status on 2018-05-29. Fedora 26 is no longer maintained, which means that it will not receive any further security or bug fix updates. As a result we are closing this bug. If you can reproduce this bug against a currently maintained version of Fedora please feel free to reopen this bug against that version. If you are unable to reopen this bug, please file a new report against the current release. If you experience problems, please add a comment to this bug. Thank you for reporting this bug and we are sorry it could not be fixed. |
Description of problem: Crash occurs on clicking 'Done' in INSTALLATION DESTINATION when running anaconda on Python 3.6. We're testing the Rawhide Python 3.6 merge; no official compose succeeded yet but I was able to build a boot.iso locally, and encountered this crash. Version-Release number of selected component: anaconda-26.16-1 The following was filed automatically by anaconda: anaconda 26.16-1 exception report Traceback (most recent call first): File "/usr/lib64/python3.6/copy.py", line 169, in deepcopy rv = reductor(4) File "/usr/lib64/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib64/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/usr/lib64/python3.6/copy.py", line 280, in _reconstruct state = deepcopy(state, memo) File "/usr/lib64/python3.6/copy.py", line 180, in deepcopy y = _reconstruct(x, memo, *rv) File "/usr/lib/python3.6/site-packages/blivet/util.py", line 847, in variable_copy setattr(new, attr, copy.deepcopy(value, memo)) File "/usr/lib/python3.6/site-packages/blivet/formats/disklabel.py", line 94, in __deepcopy__ duplicate=('_parted_disk', '_orig_parted_disk')) File "/usr/lib/python3.6/site-packages/blivet/threads.py", line 45, in run_with_lock return m(*args, **kwargs) File "/usr/lib64/python3.6/copy.py", line 161, in deepcopy y = copier(memo) File "/usr/lib/python3.6/site-packages/blivet/util.py", line 847, in variable_copy setattr(new, attr, copy.deepcopy(value, memo)) File "/usr/lib/python3.6/site-packages/blivet/devices/device.py", line 97, in __deepcopy__ shallow=('_parted_partition',)) File "/usr/lib/python3.6/site-packages/blivet/threads.py", line 45, in run_with_lock return m(*args, **kwargs) File "/usr/lib64/python3.6/copy.py", line 161, in deepcopy y = copier(memo) File "/usr/lib64/python3.6/copy.py", line 215, in _deepcopy_list append(deepcopy(a, memo)) File "/usr/lib64/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/usr/lib64/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib64/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/usr/lib64/python3.6/copy.py", line 280, in _reconstruct state = deepcopy(state, memo) File "/usr/lib64/python3.6/copy.py", line 180, in deepcopy y = _reconstruct(x, memo, *rv) File "/usr/lib64/python3.6/copy.py", line 240, in _deepcopy_dict y[deepcopy(key, memo)] = deepcopy(value, memo) File "/usr/lib64/python3.6/copy.py", line 150, in deepcopy y = copier(x, memo) File "/usr/lib64/python3.6/copy.py", line 280, in _reconstruct state = deepcopy(state, memo) File "/usr/lib64/python3.6/copy.py", line 180, in deepcopy y = _reconstruct(x, memo, *rv) File "/usr/lib/python3.6/site-packages/blivet/blivet.py", line 1746, in copy new = copy.deepcopy(self) File "/usr/lib/python3.6/site-packages/blivet/threads.py", line 45, in run_with_lock return m(*args, **kwargs) File "/usr/lib64/python3.6/site-packages/pyanaconda/storage_utils.py", line 462, in create_snapshot self._storage_snap = storage.copy() File "/usr/lib64/python3.6/site-packages/pyanaconda/ui/gui/spokes/storage.py", line 939, in on_back_clicked on_disk_storage.create_snapshot(self.storage) TypeError: can't pickle _ped.Alignment objects Additional info: addons: com_redhat_docker, com_redhat_kdump cmdline: /usr/bin/python3 /sbin/anaconda cmdline_file: BOOT_IMAGE=vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=Fedora-26-x86_64 quiet executable: /sbin/anaconda hashmarkername: anaconda kernel: 4.10.0-0.rc0.git7.1.fc26.x86_64 product: Fedora release: Cannot get release name. type: anaconda version: rawhide