You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After updating to 4.6.0 we started to experience abnormal amount of errors on our production systems reported in sentry.
Screenshots from Sentry:
To Reproduce
Steps to reproduce the behavior:
Update engineio from 4.5.1 to 4.6.0
Deploy to production
Start receiving errors
Note: I know that the "steps to reproduce" doesn't help here much, but this is exactly what happened before we started to receive errors. No other changes was made.
Expected behavior
No errors are reported by Sentry.
Logs
RuntimeError: Unexpected ASGI message 'websocket.close', after sending 'websocket.close'.
File "starlette/applications.py", line 122, in __call__
await self.middleware_stack(scope, receive, send)
File "starlette/middleware/errors.py", line 149, in __call__
await self.app(scope, receive, send)
File "starlette/middleware/base.py", line 26, in __call__
await self.app(scope, receive, send)
File "starlette/middleware/exceptions.py", line 79, in __call__
raise exc
File "starlette/middleware/exceptions.py", line 68, in __call__
await self.app(scope, receive, sender)
File "fastapi/middleware/asyncexitstack.py", line 20, in __call__
raise e
File "fastapi/middleware/asyncexitstack.py", line 17, in __call__
await self.app(scope, receive, send)
File "starlette/routing.py", line 718, in __call__
await route.handle(scope, receive, send)
File "starlette/routing.py", line 443, in handle
await self.app(scope, receive, send)
File "engineio/async_drivers/asgi.py", line 58, in __call__
await self.engineio_server.handle_request(scope, receive, send)
File "socketio/asyncio_server.py", line 398, in handle_request
return await self.eio.handle_request(*args, **kwargs)
File "engineio/asyncio_server.py", line 257, in handle_request
r = await self._handle_connect(environ, transport,
File "engineio/asyncio_server.py", line 430, in _handle_connect
ret = await s.handle_get_request(environ)
File "engineio/asyncio_socket.py", line 89, in handle_get_request
return await getattr(self, '_upgrade_' + transport)(environ)
File "engineio/asyncio_socket.py", line 143, in _upgrade_websocket
return await ws(environ)
File "engineio/async_drivers/asgi.py", line 235, in __call__
await self.handler(self)
File "engineio/asyncio_socket.py", line 253, in _websocket_handler
await asyncio.wait_for(writer_task, timeout=None)
File "asyncio/tasks.py", line 442, in wait_for
return await fut
File "engineio/asyncio_socket.py", line 207, in writer
await ws.close()
File "engineio/async_drivers/asgi.py", line 238, in close
await self.asgi_send({'type': 'websocket.close'})
File "starlette/middleware/exceptions.py", line 65, in sender
await send(message)
File "starlette/middleware/exceptions.py", line 65, in sender
await send(message)
File "uvicorn/protocols/websockets/websockets_impl.py", line 345, in asgi_send
raise RuntimeError(msg % message_type)
Additional context
Update that took place
Our setup on server:
importsocketiofromsrc.infraimportconfigfromsrc.infra.cache.redisimportRedisDBfromsrc.infra.socket_server.namespaces_containerimportregister_namespacesmgr=socketio.AsyncRedisManager(f"{config.redis.url}/{RedisDB.websockets}")
sio=socketio.AsyncServer(
async_mode="asgi",
transports=["websocket"],
logger=config.main.debug,
client_manager=mgr,
)
# connect to the redis queue as an external processregister_namespaces(sio)
app=socketio.ASGIApp(sio)
The text was updated successfully, but these errors were encountered:
detoyz
changed the title
Update to 4.6.0 tries to "double close"
Update to 4.6.0 -> Unexpected ASGI message 'websocket.close', after sending 'websocket.close'
Aug 21, 2023
@detoyz Can I ask you to install python-engineio from its main branch on this repo and retest? I believe the fix committed above addresses the problem. Once you confirm that the problem is addressed I'll do another release. Thanks.
@detoyz Can I ask you to install python-engineio from its main branch on this repo and retest? I believe the fix committed above addresses the problem. Once you confirm that the problem is addressed I'll do another release. Thanks.
Will do, thanks for the quick reply!
P.S. I really appreciate your work on socketio, it's an amazing library to work with ❤️
Describe the bug
After updating to 4.6.0 we started to experience abnormal amount of errors on our production systems reported in sentry.
Screenshots from Sentry:
To Reproduce
Steps to reproduce the behavior:
Note: I know that the "steps to reproduce" doesn't help here much, but this is exactly what happened before we started to receive errors. No other changes was made.
Expected behavior
No errors are reported by Sentry.
Logs
Additional context
Update that took place
Our setup on server:
Our setup on client:
The text was updated successfully, but these errors were encountered: