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

Netty HTTP client blocking on DNS resolution #3629

Closed
yanns opened this issue Dec 15, 2022 · 6 comments
Closed

Netty HTTP client blocking on DNS resolution #3629

yanns opened this issue Dec 15, 2022 · 6 comments
Labels
bug This issue is a bug. p3 This is a minor priority issue

Comments

@yanns
Copy link

yanns commented Dec 15, 2022

Describe the bug

Netty threads are being blocked when calling InetAddress.getByName (https://docs.oracle.com/javase/6/docs/api/java/net/InetAddress.html#getByName(java.lang.String))

Screenshot 2022-12-15 at 14 43 28

This impacts the scalability of the AWS java library.

Expected Behavior

Netty threads should not be blocked

Current Behavior

Netty threads are being blocked

Reproduction Steps

Using the NettyNioAsyncHttpClient

  val builder = NettyNioAsyncHttpClient.builder()
  val httpClient: SdkAsyncHttpClient = builder.build()

Possible Solution

A possible solution is to use netty-resolver-dns like in https://github.com/netty/netty/blob/4.1/example/src/main/java/io/netty/example/dns/tcp/TcpDnsClient.java

Additional Information/Context

No response

AWS Java SDK version used

2.18.35

JDK version used

17.0.5_8

Operating System and version

linux

@yanns yanns added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 15, 2022
@debora-ito debora-ito added the p3 This is a minor priority issue label Mar 30, 2023
@martinKindall
Copy link
Contributor

martinKindall commented Apr 28, 2023

Hi @yanns , which tool are you using to show the graphics you attached? Do you know if something similar may be used in intelliJ? I am interested in displaying the time spent in blocking calls just as you did.

@yanns
Copy link
Author

yanns commented Apr 29, 2023

The JVM is profiled with https://github.com/async-profiler/async-profiler.
The profile file is then opened by JDK mission control where the screenshot is coming from.

@martinKindall
Copy link
Contributor

martinKindall commented May 6, 2023

Thanks @yanns, I installed JDK mission control and async-profiler and both work. I already took a flamegraph profile.

I am having issues reproducing your results though using the .jfr format for the profile output. I can see the stacktrace correctly but the profiler is not saving the "Total Blocked" time, here's my command

./profiler.sh -d 20 -i 5ms -f result3.jfr <PID>

Would you mind sharing your command? So I can compare the args you used. Thanks.

@yanns
Copy link
Author

yanns commented May 6, 2023

It's a long time ago, but I think I used the following flags:
-e cpu,alloc,lock,itimer

@debora-ito debora-ito removed the needs-triage This issue or PR still needs to be triaged. label May 15, 2023
@debora-ito
Copy link
Member

Scanning through some old open issues, I believe this was addressed in PR #3990, which added the useNonBlockingDnsResolver option to NettyNioAsyncHttpClient.

Closing this.

Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p3 This is a minor priority issue
Projects
None yet
Development

No branches or pull requests

3 participants