stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

[Bug]: starlette.websockets.WebSocketDisconnect: 1006

Open loboere opened this issue 2 years ago • 21 comments
trafficstars

Is there an existing issue for this?

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

What happened?

I am using thelastben colab with controlnet when pressing generate nothing happens then I get the error starlette.websockets.WebSocketDisconnect: 1006

Steps to reproduce the problem

1-run thelastben notebook 2-load controlnet canny 3-press generate

What should have happened?

generate image

Commit where the problem happens

not

What platforms do you use to access the UI ?

No response

What browsers do you use to access the UI ?

No response

Command Line Arguments

-

List of extensions

controlnet promp travel

Console logs

2023-03-29 07:35:13.741404: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-03-29 07:35:15.144079: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia
2023-03-29 07:35:15.144216: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/lib64-nvidia
2023-03-29 07:35:15.144238: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4732:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5220:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
Loading weights [8068e1340c] from /content/gdrive/MyDrive/Fast-Dreambooth/Sessions/kirin/kirin.ckpt
Creating model from config: /content/gdrive/MyDrive/sd/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(0): 
Model loaded in 18.3s (load weights from disk: 10.3s, create model: 1.5s, apply weights to model: 3.8s, apply half(): 1.8s, move model to device: 0.9s).
Running on public URL: https://2933e13e9fcf34cc3d.gradio.live/
✔ Connected
Startup time: 54.5s (import torch: 5.6s, import gradio: 3.2s, import ldm: 0.9s, other imports: 5.0s, list SD models: 0.5s, setup codeformer: 0.3s, load scripts: 4.2s, load SD checkpoint: 18.3s, create ui: 3.1s, gradio launch: 13.4s, scripts app_started_callback: 0.1s).
Loading model: control_canny-fp16 [e3fe7712]
Loaded state_dict from [/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/models/control_canny-fp16.safetensors]
ControlNet model control_canny-fp16 [e3fe7712] loaded.
Loading preprocessor: canny
100% 20/20 [00:12<00:00,  1.61it/s]
Task exception was never retrieved
future: <Task finished name='rkk2si64dh_64' coro=<Queue.process_events() done, defined at /usr/local/lib/python3.9/dist-packages/gradio/queueing.py:343> exception=WebSocketDisconnect(1006)>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/gradio/queueing.py", line 347, in process_events
    client_awake = await self.gather_event_data(event)
  File "/usr/local/lib/python3.9/dist-packages/gradio/queueing.py", line 220, in gather_event_data
    data, client_awake = await self.get_message(event, timeout=receive_timeout)
  File "/usr/local/lib/python3.9/dist-packages/gradio/queueing.py", line 453, in get_message
    data = await asyncio.wait_for(
  File "/usr/lib/python3.9/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
  File "/usr/local/lib/python3.9/dist-packages/starlette/websockets.py", line 133, in receive_json
    self._raise_on_disconnect(message)
  File "/usr/local/lib/python3.9/dist-packages/starlette/websockets.py", line 105, in _raise_on_disconnect
    raise WebSocketDisconnect(message["code"])
starlette.websockets.WebSocketDisconnect: 1006

Additional information

No response

loboere avatar Mar 29 '23 07:03 loboere

I've had similar WebSocket disconnections with the latest versions as well. Could it be because of the gradio bump?

caxco93 avatar Mar 29 '23 16:03 caxco93

Getting the same

digital-soul18 avatar Mar 30 '23 09:03 digital-soul18

same :(

i-zet avatar Mar 30 '23 19:03 i-zet

Same

ThanapatSornsrivichai avatar Mar 31 '23 04:03 ThanapatSornsrivichai

Axibed avatar Mar 31 '23 04:03 Axibed

I ran into the same web socket error. Reverting to the commit 803d44c fixed the problem for me and him. I've pushed a Docker Image with this exact commit of stable diffusion webui:

docker pull rubbrband/sd-webui
docker run -it --gpus all rubbrband/sd-webui

I've also built an open source cli tool to automate training diffusion models, it supports stable diffusion webui too! Install it by running:

pip3 install rubbrband
rubbrband web sd-webui

rubbrband-sd-webui

darhsu avatar Mar 31 '23 09:03 darhsu

cxmxsgidqvpa1

I get an error 1006 like this?

Fatlinn avatar Apr 04 '23 10:04 Fatlinn

Rolling back to 803d44c as suggested above helps for a bit but after I restart the server I have the same problem again. This is with clearing the venv after rolling back but before launching. Another problem is that the output of the console often stalls in Windows, even though there are additional logs being written to it. I believe that's a Windows problem, but it complicates troubleshooting because I can't always see the logs until I CTRL+C to kill the server.

Oh, to be clear this happens any time i use img2img, not with any additional scripts or in a notebook.

robotfactory avatar Apr 05 '23 19:04 robotfactory

Getting the same. orz... I ran the server on one PC and tried img2img by connecting to the server from another PC on the same router.

this is my option

--autolaunch --no-half-vae --api --listen

kojdj0811 avatar Apr 10 '23 09:04 kojdj0811

same issue, when running img2img

CiaoHe avatar Apr 11 '23 03:04 CiaoHe

I am also having this issue. Reverting to the mentioned commit really did nothing for me. Using a Linux terminal pc running the webui and gradio for the share link. Has anyone had any luck so far?

MariusKM avatar Apr 11 '23 11:04 MariusKM

same issue, when running img2img. After upgrading to the new version 2023-04-14 10 40 30

APaul88 avatar Apr 13 '23 06:04 APaul88

same issue, when running img2img. After upgrading to the new version

One option is to use ngrok, please refer to this link. It works fine for me.

https://github.com/JingShing/Ngrok-in-StableDiffusion-tutorial/blob/main/README.md

msqiqi10 avatar Apr 13 '23 06:04 msqiqi10

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

APaul88 avatar Apr 14 '23 06:04 APaul88

I've been having the same issue, though I was just trying to use the img2img tab after generating an image in the txt2img tab. This is the error I'm getting. Capture

GoddessFreya13 avatar Apr 20 '23 21:04 GoddessFreya13

Failure disappears after using Firefox

NekoDream avatar Apr 24 '23 10:04 NekoDream

I have used edge and no errors to me. in chrome I have the same error: starlette.websockets.WebSocketDisconnect: 1006 solved

capcaverna avatar May 02 '23 21:05 capcaverna

same here

AI-Robot-Morris avatar May 06 '23 03:05 AI-Robot-Morris

I have used edge and no errors to me. in chrome I have the same error: starlette.websockets.WebSocketDisconnect: 1006 solved

I'm not using Chrome, but having problems with Edge😫

NekoDream avatar May 06 '23 04:05 NekoDream

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

thank you man, amazing!

Bukhlo avatar May 13 '23 18:05 Bukhlo

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

Still not work for me on Edge, Chrome, OperaGX Edit: IT WORKS F*CKING FINE ON FIREFOX BOIZZZ

Longsua123 avatar Jun 21 '23 11:06 Longsua123

Rolling back to 803d44c as suggested above helps for a bit but after I restart the server I have the same problem again. This is with clearing the venv after rolling back but before launching. Another problem is that the output of the console often stalls in Windows, even though there are additional logs being written to it. I believe that's a Windows problem, but it complicates troubleshooting because I can't always see the logs until I CTRL+C to kill the server.

Oh, to be clear this happens any time i use img2img, not with any additional scripts or in a notebook.

Little help that I wish I seen sooner than later. Stalling happens because of setting in console. Click right mouse on header, unckeck something like Enable mouse selection. After that it will not stall.

akvyalkov avatar Jul 09 '23 22:07 akvyalkov

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

Wow Thanks! you're a life saver! it worked for me as well!

danielraziel avatar Jul 21 '23 13:07 danielraziel

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

doesn't work for me

Ethean avatar Aug 01 '23 05:08 Ethean

I think I have a good news for all. Try to delete config.json and restart sd.

lockusomd avatar Sep 05 '23 10:09 lockusomd

Got this after clicking Skip button, but Stable diffusion continued generating images. Preview images stopped though.

ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\uvicorn\protocols\websockets\websockets_impl.py", line 254, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\fastapi\applications.py", line 273, in __call__
    await super().__call__(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\applications.py", line 122, in __call__
    await self.middleware_stack(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\errors.py", line 149, in __call__
    await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\cors.py", line 76, in __call__
    await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\gzip.py", line 26, in __call__
    await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 79, in __call__
    raise exc
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\middleware\exceptions.py", line 68, in __call__
    await self.app(scope, receive, sender)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in __call__
    raise e
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in __call__
    await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 718, in __call__
    await route.handle(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 341, in handle
    await self.app(scope, receive, send)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\routing.py", line 82, in app
    await func(session)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\fastapi\routing.py", line 289, in app
    await dependant.call(**values)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 604, in join_queue
    session_info = await asyncio.wait_for(
  File "C:\Python310\lib\asyncio\tasks.py", line 445, in wait_for
    return fut.result()
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\websockets.py", line 133, in receive_json
    self._raise_on_disconnect(message)
  File "D:\A111\stable-diffusion-webui\venv\lib\site-packages\starlette\websockets.py", line 105, in _raise_on_disconnect
    raise WebSocketDisconnect(message["code"])
starlette.websockets.WebSocketDisconnect: 1006

Code4SAFrankie avatar Sep 24 '23 07:09 Code4SAFrankie

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

Works perfect, I thank you with all my heart

AppStolz avatar Sep 28 '23 14:09 AppStolz

All guys, I found a way.

edit webui-user.bat try adding --no-gradio-queue 

set COMMANDLINE_ARGS= --no-gradio-queue

This just hides this server error, but I still have a problem with my image generations (especially img2img). Sometimes it stucks at ~99% progress till I interrupt this or restart SD. Maybe I shouldn't update SD anymore, cause devs fixing old bugs but adding new ones.

Aksolot146 avatar Jul 21 '24 17:07 Aksolot146