Skip to content

SSL: APPLICATION_DATA_AFTER_CLOSE_NOTIFY #125981

Closed as not planned
Closed as not planned
@stevstrong

Description

@stevstrong

Bug report

Bug description:

Hi,

I have implemented a very simple application using Quart.
OS: WIndows 11
Python version: 3.13.0
The content of main.py:

from quart import Quart, render_template

app = Quart(__name__)

@app.route("/")
async def hello():
    return await render_template("index.html", user={"name":"James","preferred_username":"[email protected]"})


if __name__ == "__main__":
    app.run(debug=True, host="0.0.0.0", port=3000, certfile='cert.pem', keyfile='key.pem')

Server started with py main.py.
Then I visit the web page on https://localhost:3000.
After exactly 5 seconds I get this message:

Unhandled exception in client_connected_cb
handle_traceback: Handle created at (most recent call last):
  File "C:\...\main.py", line 11, in <module>
    app.run(debug=True, host="0.0.0.0", port=3000, certfile='cert.pem', keyfile='key.pem')
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\quart\app.py", line 852, in run
    loop.run_until_complete(asyncio.gather(*tasks))
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 708, in run_until_complete
    self.run_forever()
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 679, in run_forever
    self._run_once()
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\base_events.py", line 2019, in _run_once
    handle._run()
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
transport: <asyncio.sslproto._SSLProtocolTransport object at 0x000001EADB922150>
Traceback (most recent call last):
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\hypercorn\asyncio\run.py", line 110, in _server_callback
    await TCPServer(app, loop, config, context, lifespan_state, reader, writer)
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\hypercorn\asyncio\tcp_server.py", line 76, in run
    await self._close()
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\site-packages\hypercorn\asyncio\tcp_server.py", line 119, in _close
    await self.writer.wait_closed()
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\streams.py", line 358, in wait_closed
    await self._protocol._get_close_waiter(self)
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\asyncio\sslproto.py", line 648, in _do_shutdown
    self._sslobj.unwrap()
    ~~~~~~~~~~~~~~~~~~~^^
  File "C:\Users\user\AppData\Local\Programs\Python\Python313\Lib\ssl.py", line 955, in unwrap
    return self._sslobj.shutdown()
           ~~~~~~~~~~~~~~~~~~~~~^^
ssl.SSLError: [SSL: APPLICATION_DATA_AFTER_CLOSE_NOTIFY] application data after close notify (_ssl.c:2706)

CPython versions tested on:

3.13

Operating systems tested on:

Windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions