Description
Greetings,
I would like to clarify a behavior of the lib.
The scenario is:
I have a fuzzer application (Python script) running TCP/UDP server on several ports, including 53. It is sending random data.
On the other side, I have a simple application which tries to connect with the fuzzer machine as if it would be a DNS server.
Test steps are:
1 - Created a SimpleResolver
(TCP)
2 - Used it to query for versions.bind
3 - Got an exception (java.io.IOException: Timed out while trying to resolve version.bind./TXT, id=44303 at org.xbill.DNS.Resolver.send(Resolver.java:172)
) - as expected (the server never intended to send valid data)
4 - On the catch block of the exception, I call NioClient.close()
5 - I leave the thread running after this
Result:
Querying netstat returns a ESTABLISHED
connection between the fuzzer and my application on port 53 with a high Recv-Q of unprocessed data.
This connection is never dropped, unless JVM is shutdown. In my case, the server also doesn't attempt to close the connection (well, it is a fuzzer, it is not supported to act nicely).
If I try the same test but with UDP resolver, there are no hanging connections after the exception is thrown.
My main concern here is: I cannot see a way how to drop these TCP connections, unless I kill my application.
Any advice? Thank you