All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
31.29k stars 3.61k forks source link

Getting websocket disconnected multiple times #2765

Open sbera7 opened 2 months ago

sbera7 commented 2 months ago

Is there an existing issue for the same bug?

Describe the bug

18:53:44 - opendevin:INFO: session.py:38 - WebSocket disconnected, sid: 10a52176-5b07-4e31-9491-a61dc78971e8
INFO:     ('127.0.0.1', 56104) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiIxMGE1MjE3Ni01YjA3LTRlMzEtOTQ5MS1hNjFkYzc4OTcxZTgifQ.sHjtG7U-ydUuwqn87AmkmLhLPDILLLQrmXoiXf8oSc4" [accepted]
Starting loop_recv for sid: 10a52176-5b07-4e31-9491-a61dc78971e8, False
18:53:44 - opendevin:INFO: session.py:38 - WebSocket disconnected, sid: 10a52176-5b07-4e31-9491-a61dc78971e8
INFO:     connection closed
6:53:44 PM [vite] ws proxy socket error:
Error: write EPIPE
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:962:11)
    at Socket._write (node:net:974:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at Socket.ondata (node:internal/streams/readable:809:22)
    at Socket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12)
    at readableAddChunk (node:internal/streams/readable:341:9)
    at Readable.push (node:internal/streams/readable:278:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
INFO:     connection open

Also showing "Connection failed. Retry..." in UI

Current OpenDevin version

1.0

Installation and Configuration

conda create -n opendevin python=3.11
conda activate opendevin
# Add Docker's official GPG key:

sudo apt-get update

sudo apt-get install ca-certificates curl

sudo install -m 0755 -d /etc/apt/keyrings

sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc

sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:

echo \

 "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \

 $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \

 sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

sudo apt-get update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

# installs NVM (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

# download and install Node.js
nvm install 20

# verifies the right Node.js version is in the environment
node -v # should print `v20.12.2`

# verifies the right NPM version is in the environment
npm -v # should print `10.5.0`
sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global
pipx install poetry
git clone https://github.com/nnilayy/OpenDevin.git
cd OpenDevin
make build
ollama serve
ollama pull mistral:7b
make run

Model and Agent

mistral:7b

Operating System

Linux

Reproduction Steps

No response

Logs, Errors, Screenshots, and Additional Context

No response

mamoodi commented 2 months ago

Does this occur when you're using OpenDevin or OpenDevin doesn't even initialize?

sbera7 commented 2 months ago

When I am using OpenDevin

mamoodi commented 2 months ago

@xingyaoww I remember you mentioned that this model isn't very good with OpenDevin and not capable enough. Is this the issue here or is the web disconnected something else entirely?

sbera7 commented 2 months ago

I do not know, I have to look into.

SmartManoj commented 2 months ago

Which browser are you using?

sbera7 commented 2 months ago

brave

SmartManoj commented 2 months ago

Could you check in Chrome/Edge or another browser except Firefox?

https://github.com/OpenDevin/OpenDevin/issues/2625#issuecomment-2194038303

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

lapochka8 commented 4 weeks ago

Experiencing a websocket disconnected issue as well, seems to occur randomly.

Using chrome Browser and GTP-4o.

session.py:66 - WebSocket disconnected, sid: ce327121-f285-4a56-9edd-9cc6a1aa99c0 ERROR: Exception in ASGI application Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 332, in asgi_send await self.send(data) # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 635, in send await self.ensure_open() File "/app/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open raise self.connection_closed_exc() websockets.exceptions.ConnectionClosedError: no close frame received or sent The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 97, in send await self._send(message) File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 50, in sender await send(message) File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 345, in asgi_send raise ClientDisconnected from exc uvicorn.protocols.utils.ClientDisconnected During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi result = await self.app(self.scope, self.asgi_receive, self.asgi_send) # type: ignore[func-returns-value] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call return await self.app(scope, receive, send) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in call await super().call(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in call await self.middleware_stack(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 151, in call await self.app(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 103, in call await self.app(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in call await self.app(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in call await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 756, in call await self.middleware_stack(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 776, in app await route.handle(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 373, in handle await self.app(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 96, in app await wrap_app_handling_exceptions(app, session)(scope, receive, send) File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app raise exc File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app await app(scope, receive, sender) File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 94, in app await func(session) File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 348, in app await dependant.call(**values) File "/app/opendevin/server/listen.py", line 264, in websocket_endpoint await websocket.send_json({'token': token, 'status': 'ok'}) File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 198, in send_json await self.send({"type": "websocket.send", "text": text}) File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 100, in send raise WebSocketDisconnect(code=1006) starlette.websockets.WebSocketDisconnect INFO: ('172.17.0.1', 53218) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiJjZTMyNzEyMS1mMjg1LTRhNTYtOWVkZC05Y2M2YTFhYTk5YzAifQ.BNxF4pGx6VEmzIp4ZzmSrPOJNA9l6LPf9pqU6R86FVs&latest_event_id=15" [accepted] INFO: connection open

remod commented 3 weeks ago

I am experiencing a similar issue. Happens every couple of minutes.

I've started opendevin with

docker run -it     --pull=always     -e SANDBOX_USER_ID=$(id -u)     -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE     -v $WORKSPACE_BASE:/opt/workspace_base     -v /var/run/docker.sock:/var/run/docker.sock     -p 3000:3000     --add-host host.docker.internal:host-gateway     --name openhands-app-$(date +%Y%m%d%H%M%S)     ghcr.io/all-hands-ai/openhands:0.8_amd64

Error message:

22:22:55 - opendevin:INFO: session.py:66 - WebSocket disconnected, sid: 855a1d05-6f21-42b4-af16-f9e22fe6a58d
ERROR:    Exception in ASGI application
Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 332, in asgi_send
    await self.send(data)  # type: ignore[arg-type]
    ^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 635, in send
    await self.ensure_open()
  File "/app/.venv/lib/python3.12/site-packages/websockets/legacy/protocol.py", line 939, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 97, in send
    await self._send(message)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 50, in sender
    await send(message)
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 345, in asgi_send
    raise ClientDisconnected from exc
uvicorn.protocols.utils.ClientDisconnected

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 244, in run_asgi
    result = await self.app(self.scope, self.asgi_receive, self.asgi_send)  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.12/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/errors.py", line 151, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/base.py", line 103, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/cors.py", line 77, in __call__
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/middleware/exceptions.py", line 65, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 756, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 776, in app
    await route.handle(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 373, in handle
    await self.app(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 96, in app
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/app/.venv/lib/python3.12/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/app/.venv/lib/python3.12/site-packages/starlette/routing.py", line 94, in app
    await func(session)
  File "/app/.venv/lib/python3.12/site-packages/fastapi/routing.py", line 348, in app
    await dependant.call(**values)
  File "/app/opendevin/server/listen.py", line 264, in websocket_endpoint
    await websocket.send_json({'token': token, 'status': 'ok'})
  File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 198, in send_json
    await self.send({"type": "websocket.send", "text": text})
  File "/app/.venv/lib/python3.12/site-packages/starlette/websockets.py", line 100, in send
    raise WebSocketDisconnect(code=1006)
starlette.websockets.WebSocketDisconnect
amanape commented 3 weeks ago

@remod @lapochka8 Can't seem to reproduce this issue. Could you list the steps you took that caused the error?

One thing I notice common between the two of you is the using a Python 3.12 venv. The official supporting Python version for OpenHands is 3.11, could you confirm that you still encounter the same issue after using 3.11 instead?