Unclosed connector
See original GitHub issueHi,
I am getting an error message when using the client.
Error message
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7fb608150c88>, 170770.66)]']
connector: <aiohttp.connector.TCPConnector object at 0x7fb608128588>
My code:
elastic_client = AsyncElasticsearch([f'{ES_USER}:{ES_PASSWORD}@{ES_HOST}'], loop=eloop)
await elastic_client.index(index=es_index(doc_type), doc_type=doc_type, body=activity)
elastic_client.transport.close()
This is called in an aiohttp.web.Application
middleware. The loop is created when the app is created using asyncio.get_event_loop()
.
The request still succeeds, but the message is noisy.
I have tried with and without the line elastic_client.transport.close()
to no avail. And sometimes (sporadically) with it there I get the error message:
/usr/local/lib/python3.6/site-packages/elasticsearch/connection_pool.py:255: RuntimeWarning: coroutine 'ClientSession.close' was never awaited
However await
the same line throws a different error.
Versions:
python ==3.6.4 elasticsearch-async ==6.0.0 aiohttp ==3.1.3
Am I doing something wrong, or is this a bug?
Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Reactions:6
- Comments:9 (1 by maintainers)
Top Results From Across the Web
Unclosed connector / client session when using asyncio
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external ...
Read more >aiohttp has a warning message "Unclosed client session"
When i running my code, it's display a warning message: Unclosed client session. Anybody can give me some solutions about that? Thanks a...
Read more >Using Asyncio with Elasticsearch
Receiving 'Unclosed client session / connector' warning?¶. This warning is created by aiohttp when an open HTTP connection is garbage collected.
Read more >Unclosed client session warning : r/redditdev
I'm making a discord bot that take a random post from any subreddit using asyncpraw and it's working normally But the problem is...
Read more >Source code for aiohttp.connector
_close_immediately() _warnings.warn(f"Unclosed connector {self!r}", ResourceWarning, source=self) context = { "connector": self, "connections": conns, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m experiencing the same issues. After server (we use sanic) stops, massive traceback occurs about error in closing session. I saw #39 PR and I think this is great and should be merged as soon as possible.
I’m still having the same issue in 2019
elasticsearch-async==6.2.0
, the pypi update is not done yet ?