Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix hostname2ip fails when aux_buf is not long enough #1818

Merged
merged 6 commits into from
Jul 1, 2022

Conversation

chenBright
Copy link
Contributor

使用Channel::Init("http://hostname", options)时,会在hostname2ip中通过gethostbyname_r获取dns的节点信息。如果hostname在dns中配置了很多节点,hostname2ip会因为aux_buf长度不够导致调用失败,从而导致Channel::Init失败。

解决方法:参考DomainNamingService获取节点信息的方法,当gethostbyname_r返回ERANGE,表示aux_buf长度不足时,将aux_buf长度增大一倍,重新调用gethostbyname_r获取节点信息,直到获取成功为止。

src/butil/endpoint.cpp Outdated Show resolved Hide resolved
src/butil/endpoint.cpp Outdated Show resolved Hide resolved
@wwbmmm
Copy link
Contributor

wwbmmm commented Jun 23, 2022

LGTM

src/butil/endpoint.cpp Outdated Show resolved Hide resolved
src/butil/endpoint.cpp Outdated Show resolved Hide resolved
@chenBright
Copy link
Contributor Author

@serverglen 修改了头文件顺序就coredump了?这个要怎么debug呢?

@serverglen
Copy link
Contributor

@serverglen 修改了头文件顺序就coredump了?这个要怎么debug呢?

gdb看下堆栈呢?

@wwbmmm
Copy link
Contributor

wwbmmm commented Jun 30, 2022

@serverglen 修改了头文件顺序就coredump了?这个要怎么debug呢?

那个core是因为test_butil里面有的case是预期要出core的,是正常的。
导致CI失败的原因是LoadBalancerTest.revived_from_all_failed_sanity 这个case,这个可能跟你的修改没有关系,可能是case不稳定。
不知道为啥点不了CI重试了,你要不重新push一次,再触发一次CI试试

@chenBright
Copy link
Contributor Author

@wwbmmm 好了

@serverglen
Copy link
Contributor

LGTM

@zyearn zyearn merged commit e8c22c9 into apache:master Jul 1, 2022
@chenBright chenBright deleted the fix_aux_buf_is_not_long_enough branch July 4, 2022 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants