Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upLookups stop working after a query that switches to TCP #95
Comments
|
Seems like what's happening is that the always-writable TCP channel is blocking the timeoutTasks to be processes by the selector loop, thus blocking any further calls to |
We've recently updated our dependency on
dnsjavafrom2.1.8to3.0.1in spotify/dns-java#38. But when testing this out with some services, we started seeing timeouts on lookups.After some debugging, I managed to isolate a scenario that causes this to happen. In our case it's caused by SRV queries on names that contain many records. We see that it first gets a truncated response over UDP and then switches to TCP. This query works fine in itself, but all subsequent queries hang for some time and hit the timeout.
It's hard to reproduce if you don't have a set of SRV records available that would trigger a switch to TCP. But here's the code that reproduces it consistently for us:
The output is
Debugging this a bit lead me to
org.xbill.DNS.Client. After the TCP Transaction is done, the NIO selector thread goes into a busy spin whereselector.select(..)always returns1signalling that the TCP channel is writable. But since there's nothing to write, theprocessReadyKeymethod onChannelStatejust returns. I have not debugged further, but I noticed this since the above program started using one core at 100% (the selector thread). I'm guessing this is what is causing subsequent requests not to process and timeout.