pushy
pushy copied to clipboard
lots of udp ports opening
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?
@jchambers any solution on this issue?
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
hi, @jianggaocheng I have upgraded io.netty:netty-resolver-dns to 4.1.53.Final, but the problem still exists.
@cyflhn Maybe other netty dependency is still low version?
@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 .
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.
@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.