layday / instawow

World of Warcraft add-on manager CLI and GUI
GNU General Public License v3.0
153 stars 9 forks source link

AIOHTTP: Event loop closed #133

Closed LordFckHelmchen closed 11 months ago

LordFckHelmchen commented 11 months ago

Hey @layday I recently updated to 3.0 and it appears the error mentioned in issues #31 is there again:

My Setup: Name Version
Windows Version 10.0.19045.3155
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
Installed packages (pip freeze)
aiohttp==3.8.4
aiohttp-client-cache==0.8.1
aiohttp-rpc==0.7.1
aiosignal==1.2.0
aiosqlite==0.17.0
alembic==1.11.1
appdirs==1.4.4
async-timeout==4.0.2
attrs==23.1.0
cattrs==23.1.2
cffi==1.15.1
chardet==4.0.0
charset-normalizer==2.1.1
click==8.1.4
clr-loader==0.2.4
colorama==0.4.4
colosseum==0.2.0
exceptiongroup==1.0.4
frozenlist==1.3.1
greenlet==1.1.0
idna==3.1
instawow==3.0.0
iso8601==1.0.2
itsdangerous==2.1.2
jarowinkler==1.2.1
jedi==0.18.2
jellyfish==0.8.2
Jinja2==3.0.3
loguru==0.7.0
Mako==1.2.4
MarkupSafe==2.0.1
multidict==5.1.0
packaging==23.1
parso==0.8.3
pluggy==0.13.1
prompt-toolkit==3.0.31
ptpython==3.0.21
pycparser==2.21
pydantic==1.9.0
Pygments==2.13.0
python-dateutil==2.8.1
python-editor==1.0.4
python-forge==18.6.0
pythonnet==3.0.0.post1
questionary==1.10.0
rapidfuzz==2.13.6
six==1.16.0
SQLAlchemy==2.0.18
toga-core==0.2.15
typing_extensions==4.3.0
url-normalize==1.4.3
wcwidth==0.2.5
win32-setctime==1.0.3
yarl==1.8.1
Git Bash Git for Windows 2.41.0.windows.1 (64-bit)

I updated aiohttp to the most recent version (for py3.9), but calling instawow update still causes the error (from cmd & Git Bash):

❯ instawow --debug update
2023-07-15 11:26:35.030 | INFO     | instawow.wa_updater:extract_installed_auras:171
  loading C:\Program Files (x86)\World of Warcraft\_classic_\WTF\Account\<MY_ACC>\SavedVariables\WeakAuras.lua from cache at C:\Users\<MY_USER>\AppData\Local\Temp\instawow\cache\103d1d1b8368cf55e16a8d6204a1b921
2023-07-15 11:26:35.038 | INFO     | instawow.wa_updater:extract_installed_auras:171
  loading C:\Program Files (x86)\World of Warcraft\_classic_\WTF\Account\<MY_ACC>\SavedVariables\Plater.lua from cache at C:\Users\<MY_USER>\AppData\Local\Temp\instawow\cache\a1027651d1452fba2a15095ab867c210
✗ tukui:13-benikui-wotlk
  package does not exist
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x00000185D88434C0>
Traceback (most recent call last):
  File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python39\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 746, in call_soon
    self._check_closed()
  File "C:\Program Files\Python39\lib\asyncio\base_events.py", line 510, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Any thoughts?

layday commented 11 months ago

Thanks for the detailed report! I think I might've been a little too eager to remove the workaround; I could swear the issue was fixed in Python 3.9, but it looks like it was only backported as far as 3.10 (https://github.com/python/cpython/issues/92841).

layday commented 11 months ago

Interestingly this error does not appear in CI: https://github.com/layday/instawow/actions/runs/5562045095/jobs/10160107275.

layday commented 11 months ago

Should be fixed in v3.0.1.

LordFckHelmchen commented 11 months ago

Hey @layday thanks for the quick action! Regarding the missing CLI - could that be because Pytest swallows your cli output and only shows it if your test fails? But since you handle it gracefully, your test didn't fail, right?

layday commented 11 months ago

On closer inspection I think it's cuz we're reusing the event loop for CLI tests (we are not spawning a new Python process) and this error is only emitted when the loop is shutting down.