Giter Club home page Giter Club logo

Comments (5)

akshayka avatar akshayka commented on July 4, 2024

More context, this time with server debug logs.

[D 240619 20:55:10 assets:76] File key provided: ibis_example.py                                                                                                                           
[D 240619 20:55:11 ws:338] Websocket disconnected for session s_prg5ll with exception (<CloseCode.ABNORMAL_CLOSURE: 1006>, None)                                                           
[D 240619 20:55:11 sessions:372] Disconnecting session consumer                                                                                                                            
ERROR:    Exception in ASGI application                                                                                                                                                    
Traceback (most recent call last):                                                                                                                                                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 963, in transfer_data                                                               
    message = await self.read_message()                                                                                                                                                    
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1033, in read_message                                                               
    frame = await self.read_data_frame(max_size=self.max_size)                                                                                                                             
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1108, in read_data_frame                                                            
    frame = await self.read_frame(max_size)                                                                                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1165, in read_frame                                                                 
    frame = await Frame.read(                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/framing.py", line 68, in read                                                                          
    data = await reader(2)                                                                                                                                                                 
  File "/opt/homebrew/Cellar/[email protected]/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/streams.py", line 721, in readexactly                                        
    raise exceptions.IncompleteReadError(incomplete, n)                                                                                                                                    
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes                                                                                                        
                                                                                                                                                                                           
The above exception was the direct cause of the following exception:                                                                                                                       
                                                                                                                                                                                           
Traceback (most recent call last):                                                                                                                                                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 332, in asgi_send                                                 
    await self.send(data)  # type: ignore[arg-type]                                                                                                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 647, in send                                                                        
    await self.write_frame(True, opcode, data)                                                                                                                                             
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1209, in write_frame                                                                
    await self.drain()                                                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 1198, in drain                                                                      
    await self.ensure_open()                                                                                                                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 97, in send                                                                               
    await self._send(message)                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 50, in sender                                                                     
    await send(message)                                                                                                                                                                    
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 83, in send_wrapper                                                              
    await send(message)                                                                                                                                                                    
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__                                                               
    return await self.app(scope, receive, send)                                                                                                                                            
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/applications.py", line 123, in __call__                                                                        
    await self.middleware_stack(scope, receive, send)                                                                                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/errors.py", line 151, in __call__                                                                   
    await self.app(scope, receive, send)                                                                                                                                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/auth.py", line 215, in __call__                                                                       
    return await super().__call__(scope, receive, send)                                                                                                                                    
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 85, in __call__                                                                  
    await self.app(scope, receive, send_wrapper)                                                                                                                                           
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/authentication.py", line 49, in __call__                                                            
    await self.app(scope, receive, send)                                                                                                                                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/cors.py", line 77, in __call__                                                                      
    await self.app(scope, receive, send)                                                                                                                                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/middleware.py", line 64, in __call__                                                                  
    return await self.app(scope, receive, send)                                                                                                                                            
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in __call__                                                                
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)                                                                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                
    raise exc                                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                
    await app(scope, receive, sender)                                                                                                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                             
    await self.middleware_stack(scope, receive, send)                                                                                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                   
    await route.handle(scope, receive, send)                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 485, in handle                                                                                                                                             
    await self.app(scope, receive, send)                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                           
    await self.middleware_stack(scope, receive, send)                                                                       
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                   
    await route.handle(scope, receive, send)                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 373, in handle                                                                                                                                             
    await self.app(scope, receive, send)                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 96, in app                    
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)                                                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                              
    raise exc                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                              
    await app(scope, receive, sender)                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 94, in app                    
    await func(session)                                       
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 76, in websocket_endpoint                                                                                                                    
    await WebsocketHandler(                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 386, in start                                                                                                                                
    await self.future                                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 318, in listen_for_messages                                                                                                                  
    await self.websocket.send_text(                           
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 188, in send_text                                                                                                                                       
    await self.send({"type": "websocket.send", "text": data})                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 100, in send                                                                                                                                            
    raise WebSocketDisconnect(code=1006)                      

from marimo.

akshayka avatar akshayka commented on July 4, 2024

Many similar failures, with the server accumulating orphaned connections (see end of below list):

[D 240619 20:55:16 ws:239] Existing sessions: {'s_nsgbwl': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d3e400>), 's_p6coxg': Session(connection_state=ConnectionState.OPEN, 
consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d7c310>), 's_uoyzbw': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102dc0940>), 's_nnh9fy': Session(co
nnection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102ddbb50>), 's_pwgnhu': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 
0x102e0cd90>), 's_ayah5b': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x10543c520>), 's_culsus': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.end
points.ws.WebsocketHandler object at 0x102a57790>), 's_clvgt7': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x105496550>), 's_saujr5': Session(connection_state=ConnectionState.O
PEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054cfdc0>), 's_v0q011': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054bf2e0>), 's_s0wxdt': Sessi
on(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1055e4f70>), 's_prg5ll': Session(connection_state=ConnectionState.ORPHANED, consumer=None), 's_y0jq9f': Session(connection_state=Connect
ionState.ORPHANED, consumer=None), 's_yrz89s': Session(connection_state=ConnectionState.ORPHANED, consumer=None)}

from marimo.

akshayka avatar akshayka commented on July 4, 2024

And logs for when a connection is refused. Not sure why there's an open, followed by reconnect, followed by refusal — browser tab wasn't refreshed or re-opened at any point. There's also some marimo code in the traceback.

[D 240619 20:55:21 ws:236] Websocket open request for session with id s_y0jq9f                                                                                                                                                                                                                                                                                                       
[D 240619 20:55:21 ws:239] Existing sessions: {'s_nsgbwl': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d3e400>), 's_p6coxg': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d7c310>), 's_uoyzbw': Session(connection_state=Con
nectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102dc0940>), 's_nnh9fy': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102ddbb50>), 's_pwgnhu': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at
 0x102e0cd90>), 's_ayah5b': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x10543c520>), 's_culsus': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102a57790>), 's_clvgt7': Session(connection_state=ConnectionState.OPEN, consumer=<ma
rimo._server.api.endpoints.ws.WebsocketHandler object at 0x105496550>), 's_saujr5': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054cfdc0>), 's_v0q011': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054bf2e0>), 's_s0wxdt': Ses
sion(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1055e4f70>), 's_prg5ll': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3040>), 's_y0jq9f': Session(connection_state=ConnectionState.ORPHANED, consumer=None), 's_yrz89s': Session(con
nection_state=ConnectionState.ORPHANED, consumer=None), 's_m383mb': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3ca0>)}                                                                                                                                                                               
[D 240619 20:55:21 ws:264] Reconnecting session s_y0jq9f                                                                                                                                                                                                                                                                                                                             
[D 240619 20:55:23 ws:236] Websocket open request for session with id s_yrz89s                                                                                                                                                                                                                                                                                                       
[D 240619 20:55:23 ws:239] Existing sessions: {'s_nsgbwl': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d3e400>), 's_p6coxg': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d7c310>), 's_uoyzbw': Session(connection_state=Con
nectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102dc0940>), 's_nnh9fy': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102ddbb50>), 's_pwgnhu': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at
 0x102e0cd90>), 's_ayah5b': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x10543c520>), 's_culsus': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102a57790>), 's_clvgt7': Session(connection_state=ConnectionState.OPEN, consumer=<ma
rimo._server.api.endpoints.ws.WebsocketHandler object at 0x105496550>), 's_saujr5': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054cfdc0>), 's_v0q011': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054bf2e0>), 's_s0wxdt': Ses
sion(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1055e4f70>), 's_prg5ll': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3040>), 's_y0jq9f': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.W
ebsocketHandler object at 0x105718220>), 's_yrz89s': Session(connection_state=ConnectionState.ORPHANED, consumer=None), 's_m383mb': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3ca0>)}
[D 240619 20:55:23 ws:264] Reconnecting session s_yrz89s                                                                                                                                                              
[D 240619 20:55:23 ws:236] Websocket open request for session with id s_prg5ll                                                                                                                                        
[D 240619 20:55:23 ws:239] Existing sessions: {'s_nsgbwl': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d3e400>), 's_p6coxg': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102d7c310>), 's_uoyzbw': Session(connection_state=Con
nectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102dc0940>), 's_nnh9fy': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102ddbb50>), 's_pwgnhu': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at
 0x102e0cd90>), 's_ayah5b': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x10543c520>), 's_culsus': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x102a57790>), 's_clvgt7': Session(connection_state=ConnectionState.OPEN, consumer=<ma
rimo._server.api.endpoints.ws.WebsocketHandler object at 0x105496550>), 's_saujr5': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054cfdc0>), 's_v0q011': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1054bf2e0>), 's_s0wxdt': Ses
sion(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1055e4f70>), 's_prg5ll': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3040>), 's_y0jq9f': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.W
ebsocketHandler object at 0x105718220>), 's_yrz89s': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x10560ad60>), 's_m383mb': Session(connection_state=ConnectionState.OPEN, consumer=<marimo._server.api.endpoints.ws.WebsocketHandler object at 0x1056f3ca0>)}
[D 240619 20:55:23 ws:245] Refusing connection; a frontend is already connected.                                                                                                                                      
ERROR:    Exception in ASGI application                                                                                                                                                                               
Traceback (most recent call last):                                                                                                                                                                                    
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 332, in asgi_send                                                                            
    await self.send(data)  # type: ignore[arg-type]                                                                                                                                                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send                                                                                                   
    await self.ensure_open()                                                                                                                                                                                          
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 97, in send                                                                                                          
    await self._send(message)                                                                                                                                                                                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 50, in sender                                                                                                
    await send(message)                                                                                                                                                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 83, in send_wrapper                                                                                         
    await send(message)                                                                                                                                                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__                                                                                          
    return await self.app(scope, receive, send)                                                                                                                                                                       
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/applications.py", line 123, in __call__                                                                                                   
    await self.middleware_stack(scope, receive, send)                                                                                                                                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/errors.py", line 151, in __call__                                                                                              
    await self.app(scope, receive, send)                                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/auth.py", line 215, in __call__                                                                                                  
    return await super().__call__(scope, receive, send)                                                                                                                                                               
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 85, in __call__                                                                                             
    await self.app(scope, receive, send_wrapper)                                                                                                                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/authentication.py", line 49, in __call__                                                                                       
    await self.app(scope, receive, send)                                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/cors.py", line 77, in __call__                                                                                                 
    await self.app(scope, receive, send)                                                                                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/middleware.py", line 64, in __call__                                                                                                                                                                                                                                                            
    return await self.app(scope, receive, send)                                                                                                                                                                       
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in __call__                                                                                                                                                                                                                                                          
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)                                                                                                                                          
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                                                                                                                                                          
    raise exc                                                                                                                                                                                                         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                                                                                                                                                          
    await app(scope, receive, sender)                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 485, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 373, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                                                                                                                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 96, in app                                                                                  
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)                                                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                                                                                                                                                          
    raise exc                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                                                                                                                                                          
    await app(scope, receive, sender)                                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 94, in app                                                                                  
    await func(session)                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 76, in websocket_endpoint                                                                                                                                                                                                                                                
    await WebsocketHandler(                                                                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 386, in start                                                                                                                                                                                                                                                            
    await self.future                                                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 318, in listen_for_messages                                                                                                                                                                                                                                              
    await self.websocket.send_text(                                                          
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 188, in send_text                                                                                                                                                                                                                                                                   
    await self.send({"type": "websocket.send", "text": data})                                                                                                                             
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 100, in send                                                                                                                                                                                                                                                                        
    raise WebSocketDisconnect(code=1006)                                                                                                                                                  
starlette.websockets.WebSocketDisconnect                                                                                                                                                  
ERROR:    Exception in ASGI application                                                      
Traceback (most recent call last):                                                                                                                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/protocols/websockets/websockets_impl.py", line 332, in asgi_send                                                                                                                                                                                                                                           
    await self.send(data)  # type: ignore[arg-type]                                          
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/websockets/legacy/protocol.py", line 635, in send                                                                                                                                                                                                                                                                  
    await self.ensure_open()                                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 97, in send                                                                                                                                                                                                                                                                         
    await self._send(message)                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 50, in sender                                                                                                                                                                                                                                                               
    await send(message)                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 83, in send_wrapper                                                                                                                                                                                                                                                        
    await send(message)                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/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 "/Users/akshay/envs/playground/lib/python3.9/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__                                                                                                                                                                                                                                                         
    return await self.app(scope, receive, send)                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/applications.py", line 123, in __call__                                                                                                                                                                                                                                                                  
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/errors.py", line 151, in __call__                                                                                                                                                                                                                                                             
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/auth.py", line 215, in __call__                                                                                                                                                                                                                                                                 
    return await super().__call__(scope, receive, send)                                                                                                                                   
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/sessions.py", line 85, in __call__                                                                                                                                                                                                                                                            
    await self.app(scope, receive, send_wrapper)                                             
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/authentication.py", line 49, in __call__                                                                                                                                                                                                                                                      
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/cors.py", line 77, in __call__                                                                                                                                                                                                                                                                
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/middleware.py", line 64, in __call__                                                                                                                                                                                                                                                            
    return await self.app(scope, receive, send)                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/middleware/exceptions.py", line 65, in __call__                                                                                                                                                                                                                                                          
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)                                                                                                              
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                                                                                                                                                          
    raise exc                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                                                                                                                                                          
    await app(scope, receive, sender)                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 485, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 373, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 96, in app                                                                                  
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)                                                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                                                                                                                                                          
    raise exc                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                                                                                                                                                          
    await app(scope, receive, sender)         
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 485, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 756, in __call__                                                                                                                                                                                                                                                                       
    await self.middleware_stack(scope, receive, send)                                                                                                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 776, in app                                                                                 
    await route.handle(scope, receive, send)                                                 
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 373, in handle                                                                                                                                                                                                                                                                         
    await self.app(scope, receive, send)                                                     
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 96, in app                                                                                  
    await wrap_app_handling_exceptions(app, session)(scope, receive, send)                                                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app                                                                                                                                                                                                                                                          
    raise exc                                                                                
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app                                                                                                                                                                                                                                                          
    await app(scope, receive, sender)                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/routing.py", line 94, in app                                                                                  
    await func(session)                                                                      
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 76, in websocket_endpoint                                                                                                                                                                                                                                                
    await WebsocketHandler(                                                                  
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 386, in start                                                                                                                                                                                                                                                            
    await self.future                                                                        
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/marimo/_server/api/endpoints/ws.py", line 318, in listen_for_messages                                                                                                                                                                                                                                              
    await self.websocket.send_text(                                                          
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 188, in send_text                                                                                                                                                                                                                                                                   
    await self.send({"type": "websocket.send", "text": data})                                                                                                                             
  File "/Users/akshay/envs/playground/lib/python3.9/site-packages/starlette/websockets.py", line 100, in send                                                                                                                                                                                                                                                                        
    raise WebSocketDisconnect(code=1006)

from marimo.

akshayka avatar akshayka commented on July 4, 2024

The WebSocket is being closed before the handshake is completed. Not sure why.

Frontend logs show:

image

Similarly when uvicorn's connection_lost() method is called, it determines that the connection was lost before the handshake was completed.

from marimo.

akshayka avatar akshayka commented on July 4, 2024

image

from marimo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.