Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-2285

Use HandshakeContext for TLS handshakes when using Go 1.17+

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.9.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Not Needed

      For connections that require TLS, the driver asynchronously performs the TLS handshake in a goroutine here. The main goroutine waits for either the handshake to complete or the context to expire. In the latter case, the driver just stops waiting for the goroutine here and returns "ctx.Err()".

      This is undesirable because it assumes that Handshake() will eventually return, which could be considered a goroutine leak. It also results in an error like "context deadline exceeded" being propagated to the application with no other information. We should consider using the new "tls.Conn#HandshakeContext" function when the application is using Go 1.17+.

            Assignee:
            benji.rewis@mongodb.com Benji Rewis (Inactive)
            Reporter:
            divjot.arora@mongodb.com Divjot Arora (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: