Skip to content

Sanic is crashing while trying to find field self._http but it not exists #3081

@zahTayar

Description

@zahTayar

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Looks like a bug in Sanic webserver.
Version downgrade solves the issue

AttributeError: 'HttpProtocol' object has no attribute '_http'. Did you mean: 'http'?
Main  2025-08-05 05:52:36 +0000 INFO: Server Stopped
2025-08-05 05:52:36,049 - sanic.root - INFO - Server Stopped
Traceback (most recent call last):
  File "/app/app.py", line 33, in <module>
    app.run(
  File "/venv/lib/python3.12/site-packages/sanic/mixins/startup.py", line 282, in run
    serve(primary=self)  # type: ignore
    ^^^^^^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/sanic/mixins/startup.py", line 1277, in serve_single
    worker_serve(monitor_publisher=None, **kwargs)
  File "/venv/lib/python3.12/site-packages/sanic/worker/serve.py", line 147, in worker_serve
    raise e
  File "/venv/lib/python3.12/site-packages/sanic/worker/serve.py", line 121, in worker_serve
    return _serve_http_1(
           ^^^^^^^^^^^^^^
  File "/venv/lib/python3.12/site-packages/sanic/server/runners.py", line 304, in _serve_http_1
    _run_server_forever(
  File "/venv/lib/python3.12/site-packages/sanic/server/runners.py", line 190, in _run_server_forever
    cleanup()
  File "/venv/lib/python3.12/site-packages/sanic/server/runners.py", line 277, in _cleanup
    connection.close_if_idle()
  File "/venv/lib/python3.12/site-packages/sanic/server/protocols/http_protocol.py", line 281, in close_if_idle
    if self._http is None or self._http.stage is Stage.IDLE:
       ^^^^^^^^^^
AttributeError: 'HttpProtocol' object has no attribute '_http'. Did you mean: 'http'? 

Code snippet

No response

Expected Behavior

No response

How do you run Sanic?

Sanic CLI

Operating System

Linux

Sanic Version

sanic==25.3.0

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    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