Skip to content

BaseTransport._fatal_error should ignore Cancellation  #36

@cigor

Description

@cigor
  • uvloop version: 0.4.31
  • python version: 3.5.2
  • platform: ubuntu 14.04
import asyncio
import os
if os.getenv('USE_UVLOOP'):
    import uvloop
    asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())



HOST="10.99.99.99"  # should not exist on your network!
PORT=9090

async def doconnect(loop):
    try:
        return await asyncio.wait_for(asyncio.open_connection(HOST, PORT), timeout=2)
    except asyncio.TimeoutError:
        pass

loop=asyncio.get_event_loop()
loop.run_until_complete( doconnect(loop))

In classic asyncio eventloop this program has no output. With USE_UVLOOP=1 it logs the following at the ERROR level

Fatal error on transport TCPTransport (connect failed)
protocol: <asyncio.streams.StreamReaderProtocol object at 0x7fb567fa29e8>
transport: <TCPTransport closed=True reading=False 0xe823e8>
concurrent.futures._base.CancelledError

IMHO this should not be logged at this level.
Cancellation should be treated the same as the other exception types that are ignored in BaseTransport._fatal_error (around line 44)

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