Tribler / tribler

Privacy enhanced BitTorrent client with P2P content discovery
https://www.tribler.org
GNU General Public License v3.0
4.86k stars 450 forks source link

`test_anon_download` failure Windows, 3.9 #8143

Closed qstokkink closed 2 months ago

qstokkink commented 2 months ago

A random failure occurred during the validation tests (Windows, Python 3.9):

Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\unittest\async_case.py", line 64, in _callTestMethod
    self._callMaybeAsync(method)
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\unittest\async_case.py", line 87, in _callMaybeAsync
    return self._asyncioTestLoop.run_until_complete(fut)
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\asyncio\base_events.py", line 647, in run_until_complete
    return future.result()
  File "C:\hostedtoolcache\windows\Python\3.9.13\x64\lib\unittest\async_case.py", line 101, in _asyncioLoopRunner
    ret = await awaitable
  File "D:\a\tribler\tribler\src\tribler\test_integration\test_anon_download.py", line 211, in test_anon_download
    download = await self.start_anon_download(infohash)
  File "D:\a\tribler\tribler\src\tribler\test_integration\test_anon_download.py", line 198, in start_anon_download
    ("127.0.0.1", self.download_manager_seeder.listen_ports[0]["127.0.0.1"])
KeyError: '127.0.0.1'

logs_28070745617.zip

qstokkink commented 2 months ago

Looking at the code, the listen_ports is only set in listen_succeeded_alert here:

https://github.com/Tribler/tribler/blob/9435d4b6fc8cce2d9f45d1f0fda2c4fbdfbdb513/src/tribler/core/libtorrent/download_manager/download_manager.py#L476-L478

The fact that this test has worked at all seems like luck.

egbertbouman commented 2 months ago

I think the test is supposed to wait until the download is active. From 7.14:

await download.wait_for_status(DownloadStatus.DOWNLOADING)
qstokkink commented 2 months ago

@egbertbouman if I try that with the reproduction patch of #8144, the test locks up.