Skip to content

Keep-alive connections prevent server from shutdown #1221

@tahajahangir

Description

@tahajahangir

Long story short

If a keep-alive connection be open (and this is very common) closing server with ^C will stuck (for 60 seconds), and process will not exit until this timeout.
This is important because during normal operation (simple HTTP request) browsers (at least Chrome and Firefox) is keeping connections alive for a while.

Expected behaviour

Normally, connections with no active http request should be closed immediately, and server should exit.
The open connections will stuck in: aiohttp/server.py#L232
And the whole process will stuck in: aiohttp/web.py#L287

I guess connections with _reading_requese=False can be closed immediately in shutdown.

Actual behaviour

Server process remains running!

Steps to reproduce

1- run a simple server:

import aiohttp.web
app = aiohttp.web.Application(debug=True)
aiohttp.web.run_app(app, host='127.0.0.1', port=8000)

2- Open Firefox/Chrome and visit http://127.0.0.1:8000, this will result in a 404 response
3- Close the server with ^C, server will not exit!

Your environment

aiohttp 1.0.2
Python 3.5.2
Arch Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions