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

Gremlin.Net.Driver should check ClientWebSocket.State before closing

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 3.2.9
    • Fix Version/s: 3.4.0, 3.3.4, 3.2.10
    • Component/s: dotnet
    • Labels:
      None

      Description

      User Sami described in a comment for TINKERPOP-2019 a situation where the Gremlin.Net.Driver tries to close a ClientWebSocket which fails because it was apparently already closed:

      System.Net.WebSockets.WebSocketException:
      at System.Net.WebSockets.WebSocketValidate.ThrowIfInvalidState (System.Net.WebSockets.Client, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
      at System.Net.WebSockets.WinHttpWebSocketState.InterlockedCheckAndUpdateState (System.Net.WebSockets.Client, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
      at System.Net.WebSockets.WinHttpWebSocket+<CloseAsync>d__30.MoveNext (System.Net.WebSockets.Client, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)
      [...]
      at Gremlin.Net.Driver.WebSocketConnection+<CloseAsync>d__4.MoveNext (Gremlin.Net, Version=3.3.0.0, Culture=neutral, PublicKeyToken=d2035e9aa387a711)
      [...]
      

      Gremlin.Net should check the state of the ClientWebSocket before trying to close it as the server could have already closed the connection.

      The implementation for this in SignalR could be a good starting point as it uses the same underlying WebSocket implementation.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Florian Hockmann Florian Hockmann
                Reporter:
                Florian Hockmann Florian Hockmann
              • Votes:
                1 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: