stable-diffusion-ps-pea icon indicating copy to clipboard operation
stable-diffusion-ps-pea copied to clipboard

[Bug]: Error received in CMD window upon completion of image in Photopea

Open camoody1 opened this issue 2 years ago • 4 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues and checked the recent builds/commits of both this extension and the webui

What happened?

Starting with a blank 512x512 canvas in Photopea. I created a new image using your plugin and the RealisticVision v5 model. The image completed successfully in Photopea, but I received a very long error in the Stable Diffusion cmd window.

Steps to reproduce the problem

Read Above

What should have happened?

I would assume I should NOT receive any error messages in the cmd window.

Commit where the problem happens

webui: v1.5.1 stable-diffusion-ps-pea: [Previous good version]

What browsers do you use to access the UI ?

Microsoft Edge

Command Line Arguments

set COMMANDLINE_ARGS= --opt-sdp-attention --xformers --autolaunch --no-half-vae --api --cors-allow-origins https://huchenlei.github.io

Console logs

100%|█████████████████████████████████████████████████████████████████████████████████| 40/40 [00:08<00:00,  4.69it/s]
100%|█████████████████████████████████████████████████████████████████████████████████| 40/40 [00:43<00:00,  1.10s/it]
ERROR:asyncio:Exception in callback H11Protocol.timeout_keep_alive_handler()██████████| 80/80 [00:56<00:00,  1.22it/s]
handle: <TimerHandle when=261762.453 H11Protocol.timeout_keep_alive_handler()>
Traceback (most recent call last):
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\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 "asyncio\events.py", line 80, in _run
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 363, in timeout_keep_alive_handler
    self.conn.send(event)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_connection.py", line 493, in send_with_data_passthrough
    self._process_event(self.our_role, event)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_connection.py", line 242, in _process_event
    self._cstate.process_event(role, type(event), server_switch_event)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_state.py", line 238, in process_event
    self._fire_event_triggered_transitions(role, event_type)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\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/api/predict {'error': 'LocalProtocolError', 'detail': '', 'body': '', 'errors': "Can't send data when our state is ERROR"}
    Traceback (most recent call last):
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
        await self.app(scope, receive, _send)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\base.py", line 109, in __call__
        await response(scope, receive, send)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 270, in __call__
        async with anyio.create_task_group() as task_group:
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\anyio\_backends\_asyncio.py", line 597, in __aexit__
        raise exceptions[0]
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 273, in wrap
        await func()
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response
        return await super().stream_response(send)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 255, in stream_response
        await send(
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\errors.py", line 159, in _send
        await send(message)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send
        output = self.conn.send(event=response)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_connection.py", line 468, in send
        data_list = self.send_with_data_passthrough(event)
      File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\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

---
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 408, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\fastapi\applications.py", line 273, in __call__
    await super().__call__(scope, receive, send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\errors.py", line 184, in __call__
    raise exc
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\errors.py", line 162, in __call__
    await self.app(scope, receive, _send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\base.py", line 109, in __call__
    await response(scope, receive, send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 270, in __call__
    async with anyio.create_task_group() as task_group:
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\anyio\_backends\_asyncio.py", line 597, in __aexit__
    raise exceptions[0]
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 273, in wrap
    await func()
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\base.py", line 134, in stream_response
    return await super().stream_response(send)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\responses.py", line 255, in stream_response
    await send(
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\starlette\middleware\errors.py", line 159, in _send
    await send(message)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 490, in send
    output = self.conn.send(event=response)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\h11\_connection.py", line 468, in send
    data_list = self.send_with_data_passthrough(event)
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\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
ERROR:asyncio:Task exception was never retrieved
future: <Task finished name='18gfcfeobsu_744' coro=<Queue.process_events() done, defined at H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\gradio\queueing.py:343> exception=ValueError('[<gradio.queueing.Event object at 0x000001D69DEE58D0>] is not in list')>
Traceback (most recent call last):
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\gradio\queueing.py", line 370, in process_events
    while response.json.get("is_generating", False):
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\gradio\utils.py", line 538, in json
    return self._json_response_data
AttributeError: 'AsyncRequest' object has no attribute '_json_response_data'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "H:\Stable Diffusion - Automatic1111\sd.webui\system\python\lib\site-packages\gradio\queueing.py", line 432, in process_events
    self.active_jobs[self.active_jobs.index(events)] = None
ValueError: [<gradio.queueing.Event object at 0x000001D69DEE58D0>] is not in list

Additional information

No response

camoody1 avatar Jul 28 '23 23:07 camoody1

I don't think the plugin calls /api/predict endpoint on A1111. I just updaetd my A1111 to 1.5.1, and cannot reproduce the issue.

Is the issue reproduced reliably?

huchenlei avatar Jul 29 '23 15:07 huchenlei

I've tried creating three images today in Photopea using your plugin and starting from a blank canvas each time. So far, I have not been able to get a single image to process to completion. Each of them eventually gets stuck during processing and just locks up. I have to close my Stable Diffusion cmd window and reopen it to process, again.

The same prompts work fine for me in Automatic1111 and complete without issue. 🤷🏽‍♂️

My inpainting seems to work fine, though. I haven't had any problem with them running to completion.

camoody1 avatar Jul 29 '23 20:07 camoody1

Well heck... I just tried several more "from blank" Img2Img jobs and they all completed successfully. I have no idea why I hadn't been able to complete one last night or earlier today. 🤷🏽‍♂️

camoody1 avatar Jul 29 '23 21:07 camoody1

I can confirm that I have had some similar stacktrace printed eariler today. It seems to only happen in the first generation when using the plugin. There is definitely something wrong with A1111.

huchenlei avatar Aug 15 '23 14:08 huchenlei