elastic-transport-python icon indicating copy to clipboard operation
elastic-transport-python copied to clipboard

Bump minimum aiohttp to 3.7.0 or greater

Open DJRickyB opened this issue 2 years ago • 0 comments

The old workaround mentioned in #49 has a limitation we hit pretty hard this week. It seems if the GET body is large enough it causes tasks immediately proceeding the pseudo-HEAD call to fail. More info is available in elastic/rally#1580, but I will put a reproduction here: Given an environment with elasticsearch[async]==8.4.0 aiohttp<3.7.0:

import asyncio

import elasticsearch
import json

es = elasticsearch.AsyncElasticsearch(
    hosts="http://localhost:9200",
    http_auth=("elastic-admin", "elastic-password")
)
print(elasticsearch.__version__)

print('Load index mappings and settings')
mappings=json.load(open('index.json'))

async def main():
    print('Clean index')
    delete_resp = await es.indices.delete(index='tsdb', ignore=[400, 404])

    print('Create index')
    create_resp = await es.indices.create(index='tsdb', body=mappings)
    
    print('Exists? Index')
    exists_resp = await es.indices.exists(index='tsdb')
    print('Delete index fails on timeout...')
    delete_resp = await es.indices.delete(index='tsdb', ignore=[400, 404])

    await es.close()
    

asyncio.run(main())

where index.json is the content of the attached file index.json.zip. If you trace with Wireshark, etc, you can see the response comes back successfully from the server, but the transport library doesn't recognize it arrived and it times out.

pip install aiohttp==3.7.0 fixes the issue

DJRickyB avatar Sep 13 '22 20:09 DJRickyB