Skip to content

Stall when connector hits limit from several connections to same bad hostname #835

Closed
@yrro

Description

Long story short

When a session's connector has a connection limit, multiple requests for a URL with a bad hostname never complete.

Expected behaviour

Script should run to completion

Actual behaviour

The second connection neither completes nor throws an error, and the script hangs.

Steps to reproduce

import aiohttp
import asyncio
import sys
import traceback

@asyncio.coroutine                                                                                  
def stall(session):
    for c in asyncio.as_completed([session.get('http://badhost.example/') for i in range(2)]):
        print(c)
        try:
            resp = yield from c
        except:
            for line in traceback.format_exception_only(*sys.exc_info()[0:2]):
                print(line, end='', file=sys.stderr)
        else:
            yield from resp.release()

loop = asyncio.get_event_loop()
with aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=1)) as session:
    loop.run_until_complete(stall(session))
loop.close()

Your environment

python 3.4.2 on Debian jessie
aiohttp 0.21.4

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions