[ 
https://issues.apache.org/jira/browse/THRIFT-5453?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yuxuan Wang resolved THRIFT-5453.
---------------------------------
    Resolution: Fixed

> go: NewTSocketConf should not call net.ResolveTCPAddr
> -----------------------------------------------------
>
>                 Key: THRIFT-5453
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5453
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Library
>    Affects Versions: 0.14.2
>            Reporter: Yuxuan Wang
>            Assignee: Yuxuan Wang
>            Priority: Major
>             Fix For: 0.15.0
>
>          Time Spent: 40m
>  Remaining Estimate: 0h
>
> 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:
>  # As the doc of [net.ResolveTCPAddr|https://pkg.go.dev/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)
>  # 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to