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

Use HandshakeContext for TLS handshakes when using Go 1.17+

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.9.0
    • None
    • None
    • None
    • Not Needed

    Description

      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+.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: