Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 916108 - sys-apps/portage: vardbapi.unpack_metadata not compatible with multiprocessing spawn start method
Summary: sys-apps/portage: vardbapi.unpack_metadata not compatible with multiprocessin...
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: 916031
Blocks: 914876
  Show dependency tree
 
Reported: 2023-10-22 08:03 UTC by Zac Medico
Modified: 2023-10-25 05:49 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-22 08:03:30 UTC
After I fixed bug 916106, I found that vardbapi.unpack_metadata contains an unpicklable local async_copy function that triggers this error with the multiprocessing spawn start method:

> >>> Running pre-merge checks for dev-libs/B-1
> Traceback (most recent call last):
>   File "portage/bin/emerge", line 62, in <module>
>     retval = emerge_main()
>   File "portage/lib/_emerge/main.py", line 1306, in emerge_main
>     return run_action(emerge_config)
>   File "portage/lib/_emerge/actions.py", line 4020, in run_action
>     retval = action_build(emerge_config, spinner=spinner)
>   File "portage/lib/_emerge/actions.py", line 677, in action_build
>     retval = mergetask.merge()
>   File "portage/lib/_emerge/Scheduler.py", line 1138, in merge
>     rval = self._merge()
>   File "portage/lib/_emerge/Scheduler.py", line 1577, in _merge
>     rval = self._sched_iface.run_until_complete(
>   File "portage/lib/portage/util/_eventloop/asyncio_event_loop.py", line 149, in _run_until_complete
>     return self._loop.run_until_complete(future)
>   File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
>     return future.result()
>   File "portage/lib/_emerge/Scheduler.py", line 979, in _run_pkg_pretend
>     await bintree.dbapi.unpack_metadata(settings, infloc, loop=loop)
>   File "portage/lib/portage/dbapi/bintree.py", line 321, in unpack_metadata
>     await add_pkg._db.unpack_metadata(pkg, dest_dir, loop=loop)
>   File "portage/lib/portage/dbapi/vartree.py", line 1028, in unpack_metadata
>     await loop.run_in_executor(ForkExecutor(loop=loop), async_copy)
>   File "/usr/lib/python3.10/asyncio/base_events.py", line 821, in run_in_executor
>     executor.submit(func, *args), loop=self)
>   File "portage/lib/portage/util/futures/executor/fork.py", line 46, in submit
>     self._schedule()
>   File "portage/lib/portage/util/futures/executor/fork.py", line 62, in _schedule
>     proc.start()
>   File "portage/lib/_emerge/AsynchronousTask.py", line 34, in start
>     self._start()
>   File "portage/lib/portage/util/_async/AsyncFunction.py", line 35, in _start
>     ForkProcess._start(self)
>   File "portage/lib/portage/util/_async/ForkProcess.py", line 61, in _start
>     retval = self._spawn(self.args, fd_pipes=self.fd_pipes)
>   File "portage/lib/portage/util/_async/ForkProcess.py", line 189, in _spawn
>     self._proc.start()
>   File "/usr/lib/python3.10/multiprocessing/process.py", line 121, in start
>     self._popen = self._Popen(self)
>   File "/usr/lib/python3.10/multiprocessing/context.py", line 224, in _Popen
>     return _default_context.get_context().Process._Popen(process_obj)
>   File "/usr/lib/python3.10/multiprocessing/context.py", line 288, in _Popen
>     return Popen(process_obj)
>   File "/usr/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 32, in __init__
>     super().__init__(process_obj)
>   File "/usr/lib/python3.10/multiprocessing/popen_fork.py", line 19, in __init__
>     self._launch(process_obj)
>   File "/usr/lib/python3.10/multiprocessing/popen_spawn_posix.py", line 47, in _launch
>     reduction.dump(process_obj, fp)
>   File "/usr/lib/python3.10/multiprocessing/reduction.py", line 60, in dump
>     ForkingPickler(file, protocol).dump(obj)
> AttributeError: Can't pickle local object 'vardbapi.unpack_metadata.<locals>.async_copy'
Comment 1 Larry the Git Cow gentoo-dev 2023-10-22 15:53:21 UTC
The bug has been referenced in the following commit(s):

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

commit c41d109b121feb0bf6199b4082a35799fdc547b9
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2023-10-22 08:28:39 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2023-10-22 08:30:50 +0000

    vardbapi.unpack_metadata: Make compatible with spawn start method
    
    This solves the following error with the multiprocessing spawn start
    method:
    
    AttributeError: Can't pickle local object 'vardbapi.unpack_metadata.<locals>.async_copy'
    
    Bug: https://bugs.gentoo.org/916108
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/dbapi/vartree.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
Comment 2 Larry the Git Cow gentoo-dev 2023-10-25 05:49:16 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b9128b401def05cac46f9e6d66048e5a0d888b8

commit 2b9128b401def05cac46f9e6d66048e5a0d888b8
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2023-10-25 05:48:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2023-10-25 05:48:40 +0000

    sys-apps/portage: add 3.0.54
    
    Closes: https://bugs.gentoo.org/905869
    Closes: https://bugs.gentoo.org/915551
    Closes: https://bugs.gentoo.org/915896
    Closes: https://bugs.gentoo.org/916106
    Closes: https://bugs.gentoo.org/916108
    Closes: https://bugs.gentoo.org/916112
    Closes: https://bugs.gentoo.org/916116
    Closes: https://bugs.gentoo.org/916139
    Closes: https://bugs.gentoo.org/916141
    Closes: https://bugs.gentoo.org/916142
    Closes: https://bugs.gentoo.org/916149
    Closes: https://bugs.gentoo.org/916182
    Closes: https://bugs.gentoo.org/916231
    Closes: https://bugs.gentoo.org/916235
    Closes: https://bugs.gentoo.org/916240
    Closes: https://bugs.gentoo.org/916242
    Closes: https://bugs.gentoo.org/916245
    Closes: https://bugs.gentoo.org/916248
    Closes: https://bugs.gentoo.org/899898
    Closes: https://bugs.gentoo.org/906129
    Closes: https://bugs.gentoo.org/906156
    Closes: https://bugs.gentoo.org/916031
    Signed-off-by: Sam James <sam@gentoo.org>

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