Skip to content

Wrong default access_log_format in web.run_app #2649

Closed
@azhpushkin

Description

Long story short

web.run_app does not provide correct default access_log_format, because of this None is being passed into AccessLogger.compile_format and causes an error. Because of this application cannot proceed requests correctly.

aiohttp/aiohttp/web.py

Lines 39 to 43 in 19c138c

def run_app(app, *, host=None, port=None, path=None, sock=None,
shutdown_timeout=60.0, ssl_context=None,
print=print, backlog=128, access_log_class=helpers.AccessLogger,
access_log_format=None, access_log=access_logger,
handle_signals=True):

Expected behaviour

Having helpers.AccessLogger.LOG_FORMAT as default value

Actual behaviour

None as default value for access log format

Steps to reproduce

from aiohttp import web

async def index(request):
    return web.Response()

app = web.Application()
app.router.add_get('/', index)
web.run_app(app, host='0.0.0.0', port=8080)

Querying 0.0.0.0:8080 returns nothing, stopping aiohttp produces following traceback before finish of the loop:

Task exception was never retrieved
future: <Task finished coro=<RequestHandler.start() done, defined at /.../aiohttp/aiohttp/web_protocol.py:343> exception=AttributeError("'RequestHandler' object has no attribute '_force_close'",)>
Traceback (most recent call last):
  File "/.../aiohttp/aiohttp/web_protocol.py", line 357, in start
    while not self._force_close:
AttributeError: 'RequestHandler' object has no attribute '_force_close'

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