Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-5453

go: NewTSocketConf should not call net.ResolveTCPAddr

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.14.2
    • 0.15.0
    • Go - Library
    • None

    Description

      Currently we call net.ResolveTCPAddr when creating a TSocket: https://github.com/apache/thrift/blob/f7e6c654bde5d9832bede2b48b460c3e1bbbbb92/lib/go/thrift/socket.go#L53

      There are two issues with this approach:

      1. As the doc of net.ResolveTCPAddr explicitly called out that "The address parameter can use a host name, but this is not recommended, because it will return at most one of the host name's IP addresses." (this is probably not a big issue as it's a connection, not a connection pool)
      2. More importantly, when we use a host name here, net.ResolveTCPAddr will do a DNS resolution and there's not any timeout attached to it (it's unbounded)

      We should preserve the hostname here, and rely on TSocket.Open (https://github.com/apache/thrift/blob/f7e6c654bde5d9832bede2b48b460c3e1bbbbb92/lib/go/thrift/socket.go#L164-L168) to do the DNS resolution as we already have timeout attached there.

      Attachments

        Issue Links

          Activity

            People

              fishywang Yuxuan Wang
              fishywang Yuxuan Wang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m