From: Brian W. <bwe...@xb...> - 2012-08-06 21:42:12
|
On Aug 6, 2012, at 12:32 PM, Casey Deccio <ca...@de...> wrote: > Hi, > > I'm using dnsjava-2.1.3 on Mac OS 10.7 Lion and java 1.6: > > $ java -version > java version "1.6.0_33" > Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720) > Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode) > > I'm unable to receive UDP responses. For example, using the provided dig class: > > $ java dig @192.0.2.1 example.com > Exception in thread "main" java.net.SocketTimeoutException > at org.xbill.DNS.Client.blockUntil(Client.java:43) > at org.xbill.DNS.UDPClient.recv(UDPClient.java:124) > at org.xbill.DNS.UDPClient.sendrecv(UDPClient.java:150) > at org.xbill.DNS.SimpleResolver.send(SimpleResolver.java:257) > at dig.main(dig.java:196) > > I get the same result if I use the library within my own class as well. I can see the packets arriving on the wire using tcpdump, but the client isn't picking them up. However, if I use resolver.setTCP(true), then it works fine. It also works fine with ISC's DiG: > > $ dig @192.0.2.1 example.com > > ; <<>> DiG 9.7.3-P3 <<>> @192.0.2.1 example.com > ; (1 server found) > ;; global options: +cmd > ;; Got answer: > ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37887 > ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 2, ADDITIONAL: 0 > > ;; QUESTION SECTION: > ;example.com. IN A > > ;; ANSWER SECTION: > example.com. 2170 IN A 192.0.43.10 > > ;; AUTHORITY SECTION: > example.com. 171370 IN NS a.iana-servers.net. > example.com. 171370 IN NS b.iana-servers.net. > > ;; Query time: 2 msec > ;; SERVER: 192.0.2.1#53(192.0.2.1) > ;; WHEN: Mon Aug 6 12:26:58 2012 > ;; MSG SIZE rcvd: 93 > > Any ideas? Until last week, my primary development platform was OS X Lion, and I never saw this. I suspect the problem might be firewall-related; when java is set to "Block incoming connections", I see timeouts with the same stack trace. I don't know what dnsjava is doing differently with respect to the network and firewall rules, but you might want to try allowing incoming connections for java to see if that fixes it. Brian |