Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-2846

Different Behavior in Response to Close Frames in Python

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 3.7.0
    • None
    • python
    • None

    Description

      Typically if a gremlin client receives a close websocket frame from the server, it will mark the current connection as dead, and attempt to create a new connection. The python GLV does not replicate this behavior, it appears that upon receiving a close web socket frame, the underlying asyncio event loop in the transporter is closed and no attempt to reconnect is made. Further, awareness of this closed state does not propagate back up to the client level as client.is_closed() will still return false. Any future requests made through this client will fail as the underlying event loop is closed.

      This behavior is demonstrated in this test from https://github.com/apache/tinkerpop/blob/master/gremlin-python/src/main/python/tests/driver/test_web_socket_client_behavior.py

      def test_does_not_create_new_connection_if_closed_by_server(socket_server_client, socket_server_settings):
              
              
                    try:
              
              
                        socket_server_client.submit(
              
              
                            "1", request_options={'requestId': socket_server_settings["CLOSE_CONNECTION_REQUEST_ID"]}).all().result()
              
              
                    except RuntimeError as err:
              
              
                        assert str(err) == "Connection was closed by server."
              
              
                
      
              
              
                    assert not socket_server_client.is_closed()
              
              
                
      
              
              
                    try:
              
              
                        response = socket_server_client.submit(
              
              
                            "1", request_options={'requestId': socket_server_settings["SINGLE_VERTEX_REQUEST_ID"]}).all().result()
              
              
                    except RuntimeError as err:
              
              
                        assert str(err) == "Event loop is closed"
              
              
                
      
              
              
                    assert not socket_server_client.is_closed() 

      Attachments

        Activity

          People

            Unassigned Unassigned
            colebq Cole Greer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: