Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 831991

Summary: sys-apps/portage: portage.process.run_exitfuncs Bad file descriptor in _thread_weakrefs_atexit for API consumer
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: CoreAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal    
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description Zac Medico gentoo-dev 2022-01-24 20:11:45 UTC
I've seen this portage.process.run_exitfuncs error intermittently from a script that uses the portage API:

> ====================================
> Error in portage.process.run_exitfuncs
> 
>   File "/usr/lib/python3.8/site-packages/portage/process.py", line 213, in run_exitfuncs
>     func(*targs, **kargs)
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/_asyncio/__init__.py", line 320, in _thread_weakrefs_atexit
>     loop.close()
>   File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
>     super().close()
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
>     self._close_self_pipe()
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 100, in _close_self_pipe
>     self._ssock.close()
>   File "/usr/lib/python3.8/socket.py", line 500, in close
>     self._real_close()
>   File "/usr/lib/python3.8/socket.py", line 494, in _real_close
>     _ss.close(self)
> [Errno 9] Bad file descriptor
> ====================================
> 
> Error in atexit._run_exitfuncs:
> Traceback (most recent call last):
>   File "/usr/lib/python3.8/site-packages/portage/process.py", line 213, in run_exitfuncs
>     func(*targs, **kargs)
>   File "/usr/lib/python3.8/site-packages/portage/util/futures/_asyncio/__init__.py", line 320, in _thread_weakrefs_atexit
>     loop.close()
>   File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
>     super().close()
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
>     self._close_self_pipe()
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 100, in _close_self_pipe
>     self._ssock.close()
>   File "/usr/lib/python3.8/socket.py", line 500, in close
>     self._real_close()
>   File "/usr/lib/python3.8/socket.py", line 494, in _real_close
>     _ss.close(self)
> OSError: [Errno 9] Bad file descriptor
> Exception ignored in: <function BaseEventLoop.__del__ at 0x7f5491ddf700>
> Traceback (most recent call last):
>   File "/usr/lib/python3.8/asyncio/base_events.py", line 656, in __del__
>   File "/usr/lib/python3.8/asyncio/unix_events.py", line 58, in close
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 92, in close
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 99, in _close_self_pipe
>   File "/usr/lib/python3.8/asyncio/selector_events.py", line 276, in _remove_reader
>   File "/usr/lib/python3.8/selectors.py", line 190, in get_key
>   File "/usr/lib/python3.8/selectors.py", line 71, in __getitem__
>   File "/usr/lib/python3.8/selectors.py", line 225, in _fileobj_lookup
>   File "/usr/lib/python3.8/selectors.py", line 42, in _fileobj_to_fd
> ValueError: Invalid file descriptor: -1