Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 738766 - sys-apps/portage: Ctrl-C with repoman --jobs displays InvalidStateError from async_iter_completed finally clause
Summary: sys-apps/portage: Ctrl-C with repoman --jobs displays InvalidStateError from ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Low enhancement
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 733180
  Show dependency tree
 
Reported: 2020-08-24 03:01 UTC by Zac Medico
Modified: 2020-08-24 03: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 2020-08-24 03:01:23 UTC
The scheduler.wait() call in the finally clause of the async_iter_completed function can raise this InvalidStateError:

> RepoMan scours the neighborhood...
> >>> Creating Manifest for /var/portage/repos/gentoo/sys-apps/portage
> ^CTraceback (most recent call last):
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/iter_completed.py", line 94, in async_iter_completed
>     scheduler.start()
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 30, in start
>     self._start()
>   File "/usr/lib/python3.8/site-packages/portage/util/_async/AsyncScheduler.py", line 90, in _start
>     self._schedule()
>   File "/usr/lib/python3.8/site-packages/_emerge/PollScheduler.py", line 152, in _schedule
>     self._schedule_tasks()
>   File "/usr/lib/python3.8/site-packages/portage/util/_async/AsyncScheduler.py", line 59, in _schedule_tasks
>     task = self._next_task()
>   File "/usr/lib/python3.8/site-packages/portage/util/_async/TaskScheduler.py", line 20, in _next_task
>     return next(self._task_iter)
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/iter_completed.py", line 69, in task_generator
>     for future in futures:
>   File "/usr/lib/python3.8/site-packages/repoman/modules/scan/depend/profile.py", line 166, in _iter_tasks
>     dep_settings = portage.config(
>   File "/usr/lib/python3.8/site-packages/portage/package/ebuild/config.py", line 361, in __init__
>     mygcfg = getconfig(x,
>   File "/usr/lib/python3.8/site-packages/portage/util/__init__.py", line 653, in getconfig
>     mykeys.update(getconfig(fname, tolerant=tolerant,
>   File "/usr/lib/python3.8/site-packages/portage/util/__init__.py", line 733, in getconfig
>     val = _unicode_decode(lex.get_token())
>   File "/usr/lib/python3.8/shlex.py", line 109, in get_token
>     raw = self.read_token()
>   File "/usr/lib/python3.8/shlex.py", line 204, in read_token
>     self.token += nextchar
>   File "/usr/lib/python-exec/python3.8/repoman", line 18, in exithandler
>     sys.exit(128 + signum)
> SystemExit: 130
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/usr/lib/python-exec/python3.8/repoman", line 44, in <module>
>     sys.exit(repoman_main(sys.argv[1:]))
>   File "/usr/lib/python3.8/site-packages/repoman/main.py", line 119, in repoman_main
>     scanner.scan_pkgs(can_force)
>   File "/usr/lib/python3.8/site-packages/repoman/scanner.py", line 367, in scan_pkgs
>     self._scan_ebuilds(ebuildlist, dynamic_data)
>   File "/usr/lib/python3.8/site-packages/repoman/scanner.py", line 390, in _scan_ebuilds
>     _continue = func(**self.set_func_kwargs(mod, dynamic_data))
>   File "/usr/lib/python3.8/site-packages/repoman/modules/scan/depend/profile.py", line 106, in check
>     loop.run_until_complete(self._async_check(loop=loop, **kwargs))
>   File "/usr/lib/python3.8/site-packages/portage/util/_eventloop/asyncio_event_loop.py", line 122, in _run_until_complete
>     return self._loop.run_until_complete(future)
>   File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
>     return future.result()
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/compat_coroutine.py", line 120, in _next
>     future = next(self._generator)
>   File "/usr/lib/python3.8/site-packages/repoman/modules/scan/depend/profile.py", line 132, in _async_check
>     for future_done_set in async_iter_completed(self._iter_tasks(loop, executor, ebuild, pkg),
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/iter_completed.py", line 112, in async_iter_completed
>     scheduler.wait()
>   File "/usr/lib/python3.8/site-packages/_emerge/AsynchronousTask.py", line 82, in wait
>     raise asyncio.InvalidStateError('Result is not ready for %s' % (self,))
> asyncio.exceptions.InvalidStateError: Result is not ready for <portage.util._async.TaskScheduler.TaskScheduler object at 0x7fdf8ccf1d60>
Comment 1 Larry the Git Cow gentoo-dev 2020-08-24 03:40:21 UTC
The bug has been referenced in the following commit(s):

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

commit b0ed587308eb3cbfafe9abcb1c59f24f48b97cdc
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-08-24 03:06:03 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-08-24 03:21:10 +0000

    async_iter_completed: fix InvalidStateError in finally clause (bug 738766)
    
    Do not attempt to wait for the TaskScheduler instance in the finally
    clause, since it will always raise InvalidStateError if its status
    is not available yet (which is normal if it has remaining tasks with
    done callbacks that have not been scheduled yet).
    
    Bug: https://bugs.gentoo.org/738766
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 lib/portage/util/futures/iter_completed.py | 1 -
 1 file changed, 1 deletion(-)
Comment 2 Larry the Git Cow gentoo-dev 2020-08-24 03:49:58 UTC
The bug has been closed via the following commit(s):

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

commit 2f2695144abefe76eea5b93d4d1966bed7bf77c1
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2020-08-24 03:47:09 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2020-08-24 03:48:20 +0000

    sys-apps/portage: 3.0.4-r1 revbump for bug 738766
    
     #738766 Ctrl-C with repoman --jobs displays InvalidStateError
    
    Bug: https://bugs.gentoo.org/733180
    Closes: https://bugs.gentoo.org/738766
    Package-Manager: Portage-3.0.4, Repoman-3.0.1
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 sys-apps/portage/{portage-3.0.4.ebuild => portage-3.0.4-r1.ebuild} | 3 +++
 1 file changed, 3 insertions(+)