Skip to content

App not closing correctly - Address in use #408

@jepgambardella

Description

@jepgambardella

Environment:

  • Python version: 3.12.8
  • Quart version: 0.20.0
  • Machine: MacOS M1 running Sequoia 15.3

When I close an app with the Ctrl+C command, then try to run it again in the same terminal window I receive this error:

  • Serving Quart app 'app'
  • Debug mode: True
  • Please use an ASGI server (e.g. Hypercorn) directly in production
  • Running on http://127.0.0.1:5000 (CTRL + C to quit)
    Traceback (most recent call last):
    File "/Users/user/ripgrep2/app.py", line 153, in
    app.run(debug=True)
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/site-packages/quart/app.py", line 878, in run
    loop.run_until_complete(asyncio.gather(*tasks))
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
    return future.result()
    ^^^^^^^^^^^^^^^
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/site-packages/hypercorn/asyncio/init.py", line 44, in serve
    await worker_serve(
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/site-packages/hypercorn/asyncio/run.py", line 91, in worker_serve
    sockets = config.create_sockets()
    ^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/site-packages/hypercorn/config.py", line 206, in create_sockets
    insecure_sockets = self._create_sockets(self.bind)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/Users/user/.pyenv/versions/3.12.8/lib/python3.12/site-packages/hypercorn/config.py", line 273, in _create_sockets
    sock.bind(binding)
    OSError: [Errno 48] Address already in use

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions