Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 915834 - sys-apps/portage: Instances of classes returned from slot_dict_class are not picklable by the multiprocessing spawn start method
Summary: sys-apps/portage: Instances of classes returned from slot_dict_class are not ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on: 915120
Blocks: 914876
  Show dependency tree
 
Reported: 2023-10-15 21:33 UTC by Zac Medico
Modified: 2023-10-20 00:51 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2023-10-15 21:33:57 UTC
The slot_dict_class function returns classes for which instances are not picklable by the multiprocessing spawn start method. This can be resolved by defining SlotObject subclasses as needed in global scope:

>   File "portage/lib/portage/dbapi/_MergeProcess.py", line 200, in _spawn
>     pids = super()._spawn(args, fd_pipes, **kwargs)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "portage/lib/portage/util/_async/ForkProcess.py", line 73, in _spawn
>     self._proc.start()
>   File "/usr/lib/python3.12/multiprocessing/process.py", line 121, in start
>     self._popen = self._Popen(self)
>                   ^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3.12/multiprocessing/context.py", line 224, in _Popen
>     return _default_context.get_context().Process._Popen(process_obj)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3.12/multiprocessing/context.py", line 289, in _Popen
>     return Popen(process_obj)
>            ^^^^^^^^^^^^^^^^^^
>   File "/usr/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 32, in __init__
>     super().__init__(process_obj)
>   File "/usr/lib/python3.12/multiprocessing/popen_fork.py", line 19, in __init__
>     self._launch(process_obj)
>   File "/usr/lib/python3.12/multiprocessing/popen_spawn_posix.py", line 47, in _launch
>     reduction.dump(process_obj, fp)
>   File "/usr/lib/python3.12/multiprocessing/reduction.py", line 60, in dump
>     ForkingPickler(file, protocol).dump(obj)
> AttributeError: Can't pickle local object 'slot_dict_class.<locals>.SlotDict'
Comment 1 Larry the Git Cow gentoo-dev 2023-10-16 04:57:06 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=8835140f9da1f43fa0e7360aaf403bc635ab7398

commit 8835140f9da1f43fa0e7360aaf403bc635ab7398
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-16 03:58:40 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-16 04:41:04 +0000

    slot_dict_class: Make instances picklable
    
    This improves compatibility with the multiprocessing spawn
    start method, by eliminating this error for MergeProcess:
    
    AttributeError: Can't pickle local object 'slot_dict_class.<locals>.LocalSlotDict'
    
    Bug: https://bugs.gentoo.org/915834
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/cache/mappings.py            | 23 +++++++++++++++++
 lib/portage/tests/process/meson.build    |  1 +
 lib/portage/tests/process/test_pickle.py | 43 ++++++++++++++++++++++++++++++++
 3 files changed, 67 insertions(+)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=67ee41a123770ae389f03abc68d65d3b4d963f30

commit 67ee41a123770ae389f03abc68d65d3b4d963f30
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-16 03:53:06 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-16 03:54:58 +0000

    slot_dict_class: Split out _SlotDict base class
    
    This is a prerequisite for pickle support.
    
    Bug: https://bugs.gentoo.org/915834
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/cache/mappings.py | 292 ++++++++++++++++++++++--------------------
 1 file changed, 151 insertions(+), 141 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2023-10-20 00:51:25 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3500483f75789c36e379c1b6546a09df7c11e2b1

commit 3500483f75789c36e379c1b6546a09df7c11e2b1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-10-20 00:49:33 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-20 00:51:00 +0000

    sys-apps/portage: add 3.0.53
    
    Closes: https://bugs.gentoo.org/915120
    Closes: https://bugs.gentoo.org/821529
    Closes: https://bugs.gentoo.org/914441
    Closes: https://bugs.gentoo.org/914722
    Closes: https://bugs.gentoo.org/914873
    Closes: https://bugs.gentoo.org/915099
    Closes: https://bugs.gentoo.org/915123
    Closes: https://bugs.gentoo.org/915128
    Closes: https://bugs.gentoo.org/915136
    Closes: https://bugs.gentoo.org/915330
    Closes: https://bugs.gentoo.org/915494
    Closes: https://bugs.gentoo.org/915834
    Closes: https://bugs.gentoo.org/915903
    Closes: https://bugs.gentoo.org/900224
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-apps/portage/Manifest              |   1 +
 sys-apps/portage/portage-3.0.53.ebuild | 238 +++++++++++++++++++++++++++++++++
 2 files changed, 239 insertions(+)