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

Asyncio SSLProto error #1601

Closed
rvorias opened this issue Apr 24, 2023 · 3 comments · Fixed by #1585
Closed

Asyncio SSLProto error #1601

rvorias opened this issue Apr 24, 2023 · 3 comments · Fixed by #1585
Labels
bug Something isn't working

Comments

@rvorias
Copy link

rvorias commented Apr 24, 2023

Steps to reproduce

  • I do not have a good idea on how to reproduce this bug, but keeps crashing my live instance.

Expected result

Hikari shard should be stable

Actual result

future: <Task finished name='Task-554' coro=<GatewayShardImpl.close() done, defined at /root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/hikari/impl/shard.py:544> exception=AttributeError("'NoneType' object has no attribute '_abort'")>
Traceback (most recent call last):
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/hikari/impl/gateway_bot.py", line 106, in _close_resource
await future
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/hikari/impl/shard.py", line 557, in close
await self._keep_alive_task
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/hikari/impl/shard.py", line 939, in _keep_alive
await ws.send_close(code=_RESUME_CLOSE_CODE, message=b"shard disconnecting temporarily")
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/hikari/impl/shard.py", line 185, in send_close
await self._exit_stack.aclose()
File "/nix/store/xscl8kqmywwjvqv7l9i5j8xb4a9b655y-python3-3.11.1/lib/python3.11/contextlib.py", line 672, in aclose
await self.__aexit__(None, None, None)
File "/nix/store/xscl8kqmywwjvqv7l9i5j8xb4a9b655y-python3-3.11.1/lib/python3.11/contextlib.py", line 730, in __aexit__
raise exc_details[1]
File "/nix/store/xscl8kqmywwjvqv7l9i5j8xb4a9b655y-python3-3.11.1/lib/python3.11/contextlib.py", line 713, in __aexit__
cb_suppress = await cb(*exc_details)
^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 1114, in __aexit__
await self.close()
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/aiohttp/client.py", line 980, in close
await self._connector.close()
^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 792, in close
return super().close()
^^^^^^^^^^^^^^^
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 409, in close
self._close()
File "/root/.cache/pypoetry/virtualenvs/bot-python-9TtSrW0h-py3.11/lib/python3.11/site-packages/aiohttp/connector.py", line 439, in _close
transport.abort()
File "/nix/store/xscl8kqmywwjvqv7l9i5j8xb4a9b655y-python3-3.11.1/lib/python3.11/asyncio/sslproto.py", line 247, in abort
self._ssl_protocol._abort()
^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute '_abort'
I 2023-04-24 14:22:40,132 hikari.bot: bot shut down successfully
I 2023-04-24 14:22:40,133 hikari.bot: successfully terminated

System info

Running on python 3.11

[tool.poetry.dependencies]
python = ">=3.11,<3.12"
hikari = "^2.0.0.dev118"
hikari-miru = "^2.0.4"
hikari-lightbulb = "^2.3.1"
python-dotenv = "^0.21.1"
aiohttp = "^3.8.4"


### Further info

I'm hosting it via railway.
I tried adding a domain (https), but didn't fix the error.

### Checklist

- [X] I have made sure to remove ANY sensitive information (bot token, passwords, credentials, personal details, etc.).
- [X] I have searched the issue tracker and have made sure it's not a duplicate. If it is a follow up of another issue, I have specified it.
@rvorias rvorias added the bug Something isn't working label Apr 24, 2023
@null-domain
Copy link
Contributor

This bug has been mentioned a few times in the hikari server - it's an issue with running hikari on Python 3.11.
This issue will be fixed as of version 2.0.0.dev119.

For now, please do either one of the following:

  • Install fix from a temporary 2.0.0.dev119 branch:
pip install git+https://github.com/davfsa/hikari@task/dont-force-close
  • Add the following lines to your bot constructor:
+from hikari.impl import config

bot = hikari.GatewayBot(
    "TOKEN",
+    http_settings=config.HTTPSettings(enable_cleanup_closed=False)
)

IIRC, the second option will become the default in dev119 (and is the change that installing from the above branch makes).

@davfsa
Copy link
Member

davfsa commented Apr 24, 2023

Thanks for the report! This is actually an issue with changes in CPython 3.11, but regardless, this will be fixed by #1585

@rvorias
Copy link
Author

rvorias commented Apr 24, 2023

Thanks for the responses!

@davfsa davfsa changed the title aiohttp ssl error Asyncio SSLProto error Apr 24, 2023
@davfsa davfsa linked a pull request Apr 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants