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

Using Proactor event loop on Windows results in random test fails #6456

Closed
ichorid opened this issue Oct 15, 2021 · 2 comments · Fixed by #6527 or #7143
Closed

Using Proactor event loop on Windows results in random test fails #6456

ichorid opened this issue Oct 15, 2021 · 2 comments · Fixed by #6527 or #7143
Assignees

Comments

@ichorid
Copy link
Contributor

ichorid commented Oct 15, 2021

https://jenkins-ci.tribler.org/job/GH_Tribler_PR_Tests/job/PR_win64_pytest/2145/console

[gw7] [ 94%] PASSED src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py::test_check_torrent_query 
src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py::test_update_entry_missing_json Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003F1D310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

[gw7] [ 94%] PASSED src/tribler-core/tribler_core/components/metadata_store/restapi/tests/test_metadata_endpoint.py::test_update_entry_missing_json Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003F1D310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003FCE310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003FCE310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003FCE310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000003FCE310>
Traceback (most recent call last):
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 719, in call_soon
    self._check_closed()
  File "c:\users\tribler\appdata\local\programs\python\python38\lib\asyncio\base_events.py", line 508, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
@ichorid
Copy link
Contributor Author

ichorid commented Oct 15, 2021

We're not the first to experience this:
encode/httpx#914

In short, related to Windows Proactor event loop implementation. The solution is to either force usage of Selector event loop for Windows test (which makes sense, since we're already forcing it for Core running on Windows), or add some asyncio.sleep() at the end of every test.

@devos50
Copy link
Contributor

devos50 commented Oct 15, 2021

The solution is to either force usage of Selector event loop for Windows test

I guess this is the best approach then since we're already running the Selector event loop in the wild.

@ichorid ichorid changed the title test_update_entry_missing_json failing on Windows randomly Using Proactor event loop on Windows results in random test fails Oct 15, 2021
@devos50 devos50 self-assigned this Nov 5, 2021
@drew2a drew2a mentioned this issue Nov 4, 2022
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.

2 participants