Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] OSError: [Errno 9] Bad file descriptor #7122

Closed
drew2a opened this issue Oct 28, 2022 · 3 comments · Fixed by #7144
Closed

[Tests] OSError: [Errno 9] Bad file descriptor #7122

drew2a opened this issue Oct 28, 2022 · 3 comments · Fixed by #7144

Comments

@drew2a
Copy link
Contributor

drew2a commented Oct 28, 2022

Occurred here #7121 in https://github.com/Tribler/tribler/actions/runs/3345978272/jobs/5542202695

src/tribler/core/components/libtorrent/restapi/tests/test_downloads_endpoint.py . [ 55%]
...............EE

==================================== ERRORS ====================================
________________ ERROR at setup of test_download_unknown_state _________________

loop = <Looptime_UnixSelectorEventLoop running=False closed=False debug=False>
aiohttp_client = <function aiohttp_client.<locals>.go at 0x7fee72ff30d0>
Exception ignored in: <Finalize object, dead>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/multiprocessing/util.py", line 224, in __call__
    res = self._callback(*self._args, **self._kwargs)
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/multiprocessing/util.py", line 464, in close_fds
    os.close(fd)
OSError: [Errno 9] Bad file descriptor
mock_dlmgr = <MagicMock id='140661746441904'>
metadata_store = <tribler.core.components.metadata_store.db.store.MetadataStore object at 0x7fee730103a0>

    @pytest.fixture
    def rest_api(loop, aiohttp_client, mock_dlmgr, metadata_store):  # pylint: disable=unused-argument
    
        endpoint = DownloadsEndpoint(mock_dlmgr, metadata_store=metadata_store)
    
        app = Application(middlewares=[error_middleware])
        app.add_subapp('/downloads', endpoint.app)
>       return loop.run_until_complete(aiohttp_client(app))

src/tribler/core/components/libtorrent/restapi/tests/test_downloads_endpoint.py:31: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/base_events.py:603: in run_until_complete
    self.run_forever()
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/base_events.py:570: in run_forever
    self._run_once()
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/base_events.py:[182](https://github.com/Tribler/tribler/actions/runs/3345978272/jobs/5542202695#step:5:183)3: in _run_once
    event_list = self._selector.select(timeout)
../../../.virtualenvs/.venv/lib/python3.8/site-packages/looptime/loops.py:110: in __replaced_select
    ready: list[tuple[Any, Any]] = self.__original_select(timeout=0)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <selectors.EpollSelector object at 0x7fee73027[190](https://github.com/Tribler/tribler/actions/runs/3345978272/jobs/5542202695#step:5:191)>, timeout = 0

    def select(self, timeout=None):
        if timeout is None:
            timeout = -1
        elif timeout <= 0:
            timeout = 0
        else:
            # epoll_wait() has a resolution of 1 millisecond, round away
            # from zero to wait *at least* timeout seconds.
            timeout = math.ceil(timeout * 1e3) * 1e-3
    
        # epoll_wait() expects `maxevents` to be greater than zero;
        # we want to make sure that `select()` can be called when no
        # FD is registered.
        max_ev = max(len(self._fd_to_key), 1)
    
        ready = []
        try:
>           fd_event_list = self._selector.poll(timeout, max_ev)
E           OSError: [Errno 9] Bad file descriptor

/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/selectors.py:468: OSError
_______________ ERROR at teardown of test_download_unknown_state _______________

    def finalizer() -> None:
        """Yield again, to finalize."""
    
        async def async_finalizer() -> None:
            try:
                await gen_obj.__anext__()
            except StopAsyncIteration:
                pass
            else:
                msg = "Async generator fixture didn't stop."
                msg += "Yield only once."
                raise ValueError(msg)
    
>       event_loop.run_until_complete(async_finalizer())

../../../.virtualenvs/.venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:291:
@drew2a
Copy link
Contributor Author

drew2a commented Oct 31, 2022

https://github.com/Tribler/tribler/actions/runs/3363436019/jobs/5576574607 in #7129

==================================== ERRORS ====================================
__________________ ERROR at teardown of test_stream_download ___________________

    def finalizer() -> None:
        """Yield again, to finalize."""
    
        async def async_finalizer() -> None:
            try:
                await gen_obj.__anext__()
            except StopAsyncIteration:
                pass
            else:
                msg = "Async generator fixture didn't stop."
                msg += "Yield only once."
                raise ValueError(msg)
    
>       event_loop.run_until_complete(async_finalizer())

../../../.virtualenvs/.venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:291: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/base_events.py:616: in run_until_complete
    return future.result()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/pytest_asyncio/plugin.py:283: in async_finalizer
    await gen_obj.__anext__()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/pytest_aiohttp/plugin.py:172: in aiohttp_client
    await clients.pop().close()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/aiohttp/test_utils.py:398: in close
    await self._server.close()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/aiohttp/test_utils.py:194: in close
    await self.runner.cleanup()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/aiohttp/web_runner.py:293: in cleanup
    await site.stop()
../../../.virtualenvs/.venv/lib/python3.8/site-packages/aiohttp/web_runner.py:72: in stop
    self._server.close()
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/base_events.py:337: in close
    self._loop._stop_serving(sock)
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/asyncio/selector_events.py:602: in _stop_serving
    sock.close()
/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/socket.py:500: in close
    self._real_close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <socket.socket [closed] fd=-1, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0>
_ss = <class '_socket.socket'>

    def _real_close(self, _ss=_socket.socket):
        # This function should not reference any globals. See issue #808[164](https://github.com/Tribler/tribler/actions/runs/3363436019/jobs/5576574607#step:4:165).
>       _ss.close(self)
E       OSError: [Errno 9] Bad file descriptor

/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/socket.py:494: OSError
----------------------------- Captured stderr call -----------------------------

@drew2a drew2a changed the title [Tests] test_download_unknown_state OSError: [Errno 9] Bad file descriptor [Tests] OSError: [Errno 9] Bad file descriptor Oct 31, 2022
@drew2a
Copy link
Contributor Author

drew2a commented Nov 1, 2022

https://github.com/Tribler/tribler/actions/runs/3367858797/jobs/5585760856 in #7112

src/tribler/core/components/gigachannel/community/tests/test_gigachannel_community.py . [ 18%]
.F
Exception ignored in: <Finalize object, dead>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/multiprocessing/util.py", line 224, in __call__

    res = self._callback(*self._args, **self._kwargs)
=================================== FAILURES ===================================
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/multiprocessing/util.py", line 464, in close_fds
    os.close(fd)
OSError: [Errno 9] Bad file descriptor
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 186, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 29] Illegal seek
Call stack:
Logged from file process_checker.py, line [85](https://github.com/Tribler/tribler/actions/runs/3367858797/jobs/5585760856#step:5:86)
Message: 'Get PID from the lock file'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 1[86](https://github.com/Tribler/tribler/actions/runs/3367858797/jobs/5585760856#step:5:87), in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 29] Illegal seek
Call stack:
Logged from file process_checker.py, line 91
Message: FileNotFoundError(2, 'No such file or directory')
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 186, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 29] Illegal seek
Call stack:
Logged from file process_checker.py, line 38
Message: 'Lock file: /tmp/pytest-of-runner/pytest-0/test_restart_tribler0/triblerd.lock'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 186, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 29] Illegal seek
Call stack:
Logged from file process_checker.py, line 165
Message: 'Restart Tribler'
Arguments: ()

@drew2a
Copy link
Contributor Author

drew2a commented Nov 4, 2022

https://github.com/Tribler/tribler/actions/runs/3393964614/jobs/5641928997

src/tribler/core/utilities/tests/test_process_checker.py ............... [ 72%]
..
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/cProfile.py", line 48, in dump_stats
INTERNALERROR>     marshal.dump(self.stats, f)
INTERNALERROR> OSError: [Errno 9] Bad file descriptor
INTERNALERROR> 
INTERNALERROR> During handling of the above exception, another exception occurred:
INTERNALERROR> 
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/_pytest/main.py", line 268, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/_pytest/main.py", line [322](https://github.com/Tribler/tribler/actions/runs/3393964614/jobs/5641928997#step:7:325), in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/pluggy/_hooks.py", line 265, in __call__
INTERNALERROR>     return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/pluggy/_manager.py", line 80, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/pluggy/_callers.py", line 60, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/pluggy/_result.py", line 60, in get_result
INTERNALERROR>     raise ex[1].with_traceback(ex[2])
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/pluggy/_callers.py", line 39, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/runner/.virtualenvs/.venv/lib/python3.8/site-packages/_pytest/main.py", line 347, in pytest_runtestloop
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 186, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 9] Bad file descriptor
Call stack:
Logged from file process_checker.py, line 85
Message: 'Get PID from the lock file'
Arguments: ()
--- Logging error ---
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 69, in emit
    if self.shouldRollover(record):
  File "/opt/hostedtoolcache/Python/3.8.14/x64/lib/python3.8/logging/handlers.py", line 186, in shouldRollover
    self.stream.seek(0, 2)  #due to non-posix-compliant Windows feature
OSError: [Errno 9] Bad file descriptor
Call stack:
Logged from file process_checker.py, line 88
Message: 'PID is 2373'
Arguments: ()
--- Logging error ---

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

1 participant