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

lots of udp ports opening #881

Open
cyflhn opened this issue Apr 19, 2021 · 7 comments
Open

lots of udp ports opening #881

cyflhn opened this issue Apr 19, 2021 · 7 comments
Milestone

Comments

@cyflhn
Copy link

cyflhn commented Apr 19, 2021

We have several apps which needs to send notifications to apns through pushy. We found that there are lots of udp ports opening on our servers. I checked the source code and found that all these ports are related to dns resolver in netty. For all ApnsClient objects, they share the same NioEventLoopGroup instance. But in AddressResolverGroup of netty, it creates an instance of InetSocketAddressResolver for each NioEventLoop . I think it is the cause of so many opening udp ports. I don't think it is necessary to create so many InetSocketAddressResolver instances. Do you have ideas to optimize this issue?

@cyflhn
Copy link
Author

cyflhn commented Apr 23, 2021

@jchambers any solution on this issue?

@jianggaocheng
Copy link

Hi @cyflhn

I have the same issue, and finally I found that may be some netty packages were downgraded to lower versions caused by other dependencies.

In my case, io.netty:netty-resolver-dns is downgraded to 4.1.29.Final, that caused too many udp ports opening, After I forced set the io.netty:netty-resolver-dns to a higher version, the issue resolved.

+--- com.eatthepath:pushy:0.14.2
|    |    +--- io.netty:netty-codec-http2:4.1.53.Final -> 4.1.29.Final
|    |    |    +--- io.netty:netty-codec-http:4.1.29.Final
|    |    |    |    \--- io.netty:netty-codec:4.1.29.Final (*)
|    |    |    \--- io.netty:netty-handler:4.1.29.Final (*)
|    |    +--- io.netty:netty-handler-proxy:4.1.53.Final -> 4.1.29.Final
|    |    |    +--- io.netty:netty-transport:4.1.29.Final -> 4.1.62.Final (*)
|    |    |    +--- io.netty:netty-codec-socks:4.1.29.Final
|    |    |    |    \--- io.netty:netty-codec:4.1.29.Final (*)
|    |    |    \--- io.netty:netty-codec-http:4.1.29.Final (*)
|    |    +--- io.netty:netty-resolver-dns:4.1.53.Final -> 4.1.29.Final (*)
|    |    +--- com.eatthepath:fast-uuid:0.1
|    |    \--- org.slf4j:slf4j-api:1.7.21 -> 1.7.25

@cyflhn
Copy link
Author

cyflhn commented May 6, 2021

hi, @jianggaocheng
I have upgraded io.netty:netty-resolver-dns to 4.1.53.Final, but the problem still exists.

@jianggaocheng
Copy link

@cyflhn Maybe other netty dependency is still low version?

@cyflhn
Copy link
Author

cyflhn commented May 9, 2021

@jianggaocheng I am sure there is no other netty dependencies in our module. You can look into the source code of getResolver method in AddressResolverGroup. If all apns clients share a common nioeventgroup, it is possible that there are lots of instances of dns AddressResolver which are created by getResolver method .

@jchambers
Copy link
Owner

Folks, is this causing a practical problem? In the absence of actually harmful side effects, my thought is that the best way to address this is to get #540 done.

@cyflhn
Copy link
Author

cyflhn commented May 11, 2021

@jchambers the number of opening udp ports is limited on a server, we need udp ports to resolve other domains. On the other hand, it is not necessary to open so many udp ports to resolve the same domain. it is a kind of big waste of udp resources.

@jchambers jchambers added this to the v0.16.0 milestone Feb 12, 2022
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

No branches or pull requests

3 participants