Skip to content

[Bug]: Can't send data when our state is ERROR,Exception in callback H11Protocol.timeout_keep_alive_handler(),the speed of image generation will decrease by 10 times #10510

Description

@wzgrx

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

An error was reported

Steps to reproduce the problem

When generating images, the console will report an error and the speed of image generation will decrease by 10 times

What should have happened?

The speed is normal and there are no errors reported

Commit where the problem happens

ae252cd

What platforms do you use to access the UI ?

Windows

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

--medvram --theme dark --xformers

List of extensions

no

Console logs

Exception in callback H11Protocol.timeout_keep_alive_handler()
handle: <TimerHandle when=40339.343 H11Protocol.timeout_keep_alive_handler()>
Traceback (most recent call last):
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 249, in _fire_event_triggered_transitions
    new_state = EVENT_TRIGGERED_TRANSITIONS[role][state][event_type]
KeyError: <class 'h11._events.ConnectionClosed'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 383, in timeout_keep_alive_handler
    self.conn.send(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 493, in send_with_data_passthrough
    self._process_event(self.our_role, event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 242, in _process_event
    self._cstate.process_event(role, type(event), server_switch_event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 238, in process_event
    self._fire_event_triggered_transitions(role, event_type)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 251, in _fire_event_triggered_transitions
    raise LocalProtocolError(
h11._util.LocalProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE
Exception in callback H11Protocol.timeout_keep_alive_handler()

handle: <TimerHandle when=40339.343 H11Protocol.timeout_keep_alive_handler()>
Traceback (most recent call last):
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 249, in _fire_event_triggered_transitions
    new_state = EVENT_TRIGGERED_TRANSITIONS[role][state][event_type]
KeyError: <class 'h11._events.ConnectionClosed'>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 383, in timeout_keep_alive_handler
    self.conn.send(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 493, in send_with_data_passthrough
    self._process_event(self.our_role, event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 242, in _process_event
    self._cstate.process_event(role, type(event), server_switch_event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 238, in process_event
    self._fire_event_triggered_transitions(role, event_type)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_state.py", line 251, in _fire_event_triggered_transitions
    raise LocalProtocolError(
h11._util.LocalProtocolError: can't handle event type ConnectionClosed when role=SERVER and state=SEND_RESPONSE
API error: POST: http://127.0.0.1:7860/run/predict {'error': 'LocalProtocolError', 'detail': '', 'body': '', 'errors': "Can't send data when our state is ERROR"}
┌───────────────────── Traceback (most recent call last) ─────────────────────┐
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\ │
│ errors.py:162 in __call__                                                   │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\ │
│ base.py:109 in __call__                                                     │
│                                                                             │
│                           ... 7 frames hidden ...                           │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py:46 │
│ 8 in send                                                                   │
│                                                                             │
│   467 │   │   """
│ > 468 │   │   data_list = self.send_with_data_passthrough(event)            │
│   469 │   │   if data_list is None:                                         │
│                                                                             │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ event = Response(status_code=200, headers=<Headers([(b'date', b'Thu, 18 │ │
│ │         May 2023 11:47:22 GMT'), (b'server', b'uvicorn'),               │ │
│ │         (b'content-length', b'5533'), (b'content-type',                 │ │
│ │         b'application/json'), (b'content-encoding', b'gzip'), (b'vary', │ │
│ │         b'Accept-Encoding'), (b'x-process-time', b'5.7649')])>,         │ │
│ │         http_version=b'1.1', reason=b'OK')                              │ │
│ │  self = <h11._connection.Connection object at 0x00000248A76495A0>       │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py:48 │
│ 3 in send_with_data_passthrough                                             │
│                                                                             │
│   482 │   │   if self.our_state is ERROR:                                   │
│ > 483 │   │   │   raise LocalProtocolError("Can't send data when our state  │
│   484 │   │   try:                                                          │
│                                                                             │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ event = Response(status_code=200, headers=<Headers([(b'date', b'Thu, 18 │ │
│ │         May 2023 11:47:22 GMT'), (b'server', b'uvicorn'),               │ │
│ │         (b'content-length', b'5533'), (b'content-type',                 │ │
│ │         b'application/json'), (b'content-encoding', b'gzip'), (b'vary', │ │
│ │         b'Accept-Encoding'), (b'x-process-time', b'5.7649')])>,         │ │
│ │         http_version=b'1.1', reason=b'OK')                              │ │
│ │  self = <h11._connection.Connection object at 0x00000248A76495A0>       │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
LocalProtocolError: Can't send data when our state is ERROR

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 273, in __call__
    await super().__call__(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in __call__
    await response(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in __call__
    async with anyio.create_task_group() as task_group:
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 662, in __aexit__
    raise exceptions[0]
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap
    await func()
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response
    return await super().stream_response(send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response
    await send(
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send
    await send(message)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 512, in send
    output = self.conn.send(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 483, in send_with_data_passthrough
    raise LocalProtocolError("Can't send data when our state is ERROR")
h11._util.LocalProtocolError: Can't send data when our state is ERROR
API error: POST: http://127.0.0.1:7860/run/predict {'error': 'LocalProtocolError', 'detail': '', 'body': '', 'errors': "Can't send data when our state is ERROR"}
┌───────────────────── Traceback (most recent call last) ─────────────────────┐
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\ │
│ errors.py:162 in __call__                                                   │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\ │
│ base.py:109 in __call__                                                     │
│                                                                             │
│                           ... 7 frames hidden ...                           │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py:46 │
│ 8 in send                                                                   │
│                                                                             │
│   467 │   │   """                                                           │
│ > 468 │   │   data_list = self.send_with_data_passthrough(event)            │
│   469 │   │   if data_list is None:                                         │
│                                                                             │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ event = Response(status_code=200, headers=<Headers([(b'date', b'Thu, 18 │ │
│ │         May 2023 11:47:22 GMT'), (b'server', b'uvicorn'),               │ │
│ │         (b'content-length', b'5615'), (b'content-type',                 │ │
│ │         b'application/json'), (b'content-encoding', b'gzip'), (b'vary', │ │
│ │         b'Accept-Encoding'), (b'x-process-time', b'6.091')])>,          │ │
│ │         http_version=b'1.1', reason=b'OK')                              │ │
│ │  self = <h11._connection.Connection object at 0x00000248A7CB2260>       │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
│                                                                             │
│ G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py:48 │
│ 3 in send_with_data_passthrough                                             │
│                                                                             │
│   482 │   │   if self.our_state is ERROR:                                   │
│ > 483 │   │   │   raise LocalProtocolError("Can't send data when our state  │
│   484 │   │   try:                                                          │
│                                                                             │
│ ┌──────────────────────────────── locals ─────────────────────────────────┐ │
│ │ event = Response(status_code=200, headers=<Headers([(b'date', b'Thu, 18 │ │
│ │         May 2023 11:47:22 GMT'), (b'server', b'uvicorn'),               │ │
│ │         (b'content-length', b'5615'), (b'content-type',                 │ │
│ │         b'application/json'), (b'content-encoding', b'gzip'), (b'vary', │ │
│ │         b'Accept-Encoding'), (b'x-process-time', b'6.091')])>,          │ │
│ │         http_version=b'1.1', reason=b'OK')                              │ │
│ │  self = <h11._connection.Connection object at 0x00000248A7CB2260>       │ │
│ └─────────────────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────────────┘
LocalProtocolError: Can't send data when our state is ERROR
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 428, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 273, in __call__
    await super().__call__(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 109, in __call__
    await response(scope, receive, send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 270, in __call__
    async with anyio.create_task_group() as task_group:
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 662, in __aexit__
    raise exceptions[0]
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 273, in wrap
    await func()
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response
    return await super().stream_response(send)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\responses.py", line 255, in stream_response
    await send(
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 159, in _send
    await send(message)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 512, in send
    output = self.conn.send(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "G:\Soft\stable-diffusion-webui\venv\lib\site-packages\h11\_connection.py", line 483, in send_with_data_passthrough
    raise LocalProtocolError("Can't send data when our state is ERROR")
h11._util.LocalProtocolError: Can't send data when our state is ERROR

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-reportReport of a bug, yet to be confirmed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions