aiohttp icon indicating copy to clipboard operation
aiohttp copied to clipboard

Post request taking unusually long to reach server (~2.5 seconds)

Open skier233 opened this issue 2 years ago • 1 comments

Describe the bug

I'm actually observing a bug in Rasa Open Source with a 2.5 second delay but I added debug statements in that code and was able to narrow down the source of the delay to an aiohttp call.

I have this aiohttp call:

async with aiohttp.ClientSession(timeout=timeout) as session:
    logger.debug("debug 28")
    async with session.post(url, json=payload, raise_for_status=True, ssl=False) as resp:

which calls into this in the server:

@custom_webhook.route("/webhook", methods=["POST"])
async def receive(request: Request) -> Union[ResponseStream, HTTPResponse]:
    logger.debug("debug 36")

and I'm seeing a delay of about 2.5 seconds between aiohttp sending this post request (debug 28) and the server receiving the request (debug 36). Does anyone know what the cause of this issue might be?

To Reproduce

See above

Expected behavior

An expected response time is expected

Logs/tracebacks

see above

Python Version

3.8.0

aiohttp Version

3.7.4

multidict Version

5.2.0

yarl Version

1.7.2

OS

Windows python virtual environment

Related component

Server, Client

Additional context

No response

Code of Conduct

  • [X] I agree to follow the aio-libs Code of Conduct

skier233 avatar Jun 30 '22 15:06 skier233

Any help with this would be greatly appreciated!

skier233 avatar Jul 05 '22 18:07 skier233