Use ConnectAsync in synchronous code-path to avoid dead-locks

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 3.7.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      TcpStreamFactory.Connect method uses sync socket.Connect with timer-based cancellation on another thread, which in some rare cases leads to dead-locks on Linux and Mac in case of cancellation/timeout occurred while Socket is being connection.

      We can use socket.ConnectAsync with combination of Task.Wait to mitigate the problem. Even though calling async method from sync code path is not a recommended way, it could be acceptable here as socket is being connected not that often.

            Assignee:
            Oleksandr Poliakov
            Reporter:
            Oleksandr Poliakov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: