Clear DNS cache?

It seems that Wildfire has its own caching resolver. A remote server has changed IP address and I have cleared my own caching resolver that the system should use. I can not do service discovery for the remote server from my account at my wildfire server. This (another renumbering event) also happend yesterday and I restarted wildfire and I was again able to do service discovery immediately after.

Is there some way to clear the cache in the internal resolver without restarting Wildfire, or do I have to wait? Will waiting for the internal cache to expire help or does it keep the records forever?

To explain which kind of errors I get (example.se and jabber.example.se are fake in this log):

2006.11.09 14:04:06 org.jivesoftware.wildfire.server.OutgoingServerSession.createOutgoingSession(Out goingServerSession.java:259) Error trying to connect to remote server: example.se(DNS lookup: jabber.example.se:5269)

java.net.SocketTimeoutException: connect timed out

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:516)

at org.jivesoftware.wildfire.server.OutgoingServerSession.createOutgoingSession(Ou tgoingServerSession.java:254)

at org.jivesoftware.wildfire.server.OutgoingServerSession.authenticateDomain(Outgo ingServerSession.java:140)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise.createSessionAndSendPac ket(OutgoingSessionPromise.java:130)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise.access$300(OutgoingSess ionPromise.java:40)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise$1$1.run(OutgoingSession Promise.java:95)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 650)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

at java.lang.Thread.run(Thread.java:595)

2006.11.09 14:04:06 org.jivesoftware.wildfire.server.OutgoingServerSession.createOutgoingSession(Out goingServerSession.java:259) Error trying to connect to remote server: se(DNS lookup: se:5269)

java.net.UnknownHostException: se

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)

at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

at java.net.Socket.connect(Socket.java:516)

at org.jivesoftware.wildfire.server.OutgoingServerSession.createOutgoingSession(Ou tgoingServerSession.java:254)

at org.jivesoftware.wildfire.server.OutgoingServerSession.authenticateDomain(Outgo ingServerSession.java:183)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise.createSessionAndSendPac ket(OutgoingSessionPromise.java:130)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise.access$300(OutgoingSess ionPromise.java:40)

at org.jivesoftware.wildfire.server.OutgoingSessionPromise$1$1.run(OutgoingSession Promise.java:95)

at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 650)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)

at java.lang.Thread.run(Thread.java:595)

I know jabber.example.se has changed IP address. The old information should have expired by now. I can disco jabber.example.se from another server and connect by telnet from the same server so it seems Wildfire caches the IP address by itself. Any way to purge it or force an update?

Hi,

i do have the exact same problems with servers that are hosted via dyndns hostname-ip-redirectors. After the ip change my server cannot contact the dyndns-hosted server because its ip has changed.

is there a way to configure, that the dns cache should be cleared within a certain time intervall?

greetings,

Bernd

Hi,

Java itself caches DNS responses, see http://java.sun.com/j2se/1.5.0/docs/guide/net/properties.html

So it could help to add -Dnetworkaddress.cache.ttl=600 to the Java start command or the vmoptions file. And of course -Djava.net.preferIPv4Stack=true unless you are using IPv6, this will improve the lookup process a lot.

LG

Thanks, that certainly seems to be a good reason why it cached infinitely. What a stupid design choice from the java developers, the default TTL should be whatever the resolver reports.

I can’‘t test if the change actually does anything as nothing has been renumbered yet (and I hope I don’'t have to) but it sure seems promising.

I think, it should work, if you modify the file

$wildfire_installation_dir/bin/wildfire

around line 250, after it says

echo “Starting wildfire”

nohup “$app_java_home/bin/java” -server -Dinstall4j.jvmDir="$app_java_home" …

change this line to:

nohup “$app_java_home/bin/java” -server -Dnetworkaddress.cache.ttl=60 -Dinstall4j.jvmDir="$app_java_home" …

That should fix it, and the underlying dns resolver should do the caching.

I’‘m seeing the same problem here too. I host a Wildfire server at home, and I have a dynamic IP, with a DynDNS entry. What I see is that when my IP changes, I can’'t contact any of my friends that use a Wildfire server (any of the other Jabber servers are fine). I can only start talking with them once their server is restarted. When looking at a network capture, you can see my Wildfire server successfully contacting the other Wildfire server, and ask for a dial-back. The other Wildfire server then attempts to dial my Wildfire server back, using an invalidly cached IP. This cannot succeed, so the connection fails.

I would say that the best default would be to disable IP caching entirely, leaving that to the system’'s resolver. I believe this can be by dropping:

java.security.Security.setProperty(“networkaddress.cache.ttl” , “0”);

into Wildfire’'s code.

Please fix this problem so I can talk with my friends!

JM-898 to track the progress and vote for it.

LG