[jitsi-dev] Failure to fetch dictionaries when ipv6 is enabled


#1

Hello,

When I try to set the language for the spellchecker to one that is
unavailable, it fails to download the dictionary. What happens is
URL.openStream()
fails to make an ipv6 connection and throws a NoRouteToHostException.
I don't have a working ipv6 configuration, but the stack is up -- I
think this is not unusual. When running with the 'run-v4' ant target
there is no problem.

What I expect to happen is ipv4 to be tried in case the ipv6 connection
fails. Is there a way to make java's URL.openStream() behave in that way?

A quick test with apache's HttpClient (through jitsi's HttpUtils) gave
the same results, but maybe it's easier to tweak?

Attached is a full log, and here is the snippet from the exception:

     [java] 15:31:07.072 WARNING:
plugin.spellcheck.LanguageMenuBar.construct().595 Unable to retrieve
dictionary for Afrikaans (South Africa) (af,za)
     [java] java.net.NoRouteToHostException: No route to host
     [java] at java.net.PlainSocketImpl.socketConnect(Native Method)
     [java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
     [java] at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
     [java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
     [java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
     [java] at java.net.Socket.connect(Socket.java:525)
     [java] at java.net.Socket.connect(Socket.java:475)
     [java] at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
     [java] at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
     [java] at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
     [java] at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
     [java] at sun.net.www.http.HttpClient.New(HttpClient.java:306)
     [java] at sun.net.www.http.HttpClient.New(HttpClient.java:323)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
     [java] at java.net.URL.openStream(URL.java:1010)
     [java] at
net.java.sip.communicator.plugin.spellcheck.SpellChecker.setLocale(SpellChecker.java:364)
     [java] at
net.java.sip.communicator.plugin.spellcheck.LanguageMenuBar$SetSpellChecker.construct(LanguageMenuBar.java:589)
     [java] at
net.java.sip.communicator.util.swing.SwingWorker$2.run(SwingWorker.java:161)
     [java] at java.lang.Thread.run(Thread.java:637)

Boris

P.S. I just noticed that the youtube url replacement doesn't work here
aswell, apparently for the same reason (NoRouteToHostException
exception thrown from
net.java.sip.communicator.impl.replacement.youtube.ReplacementServiceYoutubeImpl.getReplacement(ReplacementServiceYoutubeImpl.java:70))

jitsi0.log.0 (562 KB)


#2

Hi Boris,

Hello,

When I try to set the language for the spellchecker to one that is
unavailable, it fails to download the dictionary. What happens is
URL.openStream()
fails to make an ipv6 connection and throws a NoRouteToHostException.
I don't have a working ipv6 configuration, but the stack is up -- I
think this is not unusual. When running with the 'run-v4' ant target
there is no problem.

What I expect to happen is ipv4 to be tried in case the ipv6 connection
fails. Is there a way to make java's URL.openStream() behave in that way?

A quick test with apache's HttpClient (through jitsi's HttpUtils) gave
the same results, but maybe it's easier to tweak?

Yes, I also think that tweaking and using HttpUtils will be easier,
you can see there are two TODOs there, to implement our socket factory
so we can use our dns resolution, and also we can be catching
NoRouteToHostException (and/or other connection problems) and we can
retry with other addresses.
This is the way we handle xmpp and sip connections: make a list of
possible addresses, discovered using the dns mechanisms and retry with
the next if the connection fail for one of them.

Regards
damencho

···

On Fri, Aug 10, 2012 at 3:51 PM, Boris Grozev <boris@mustelinae.net> wrote:

Attached is a full log, and here is the snippet from the exception:

     [java] 15:31:07.072 WARNING:
plugin.spellcheck.LanguageMenuBar.construct().595 Unable to retrieve
dictionary for Afrikaans (South Africa) (af,za)
     [java] java.net.NoRouteToHostException: No route to host
     [java] at java.net.PlainSocketImpl.socketConnect(Native Method)
     [java] at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
     [java] at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
     [java] at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
     [java] at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:432)
     [java] at java.net.Socket.connect(Socket.java:525)
     [java] at java.net.Socket.connect(Socket.java:475)
     [java] at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
     [java] at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
     [java] at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
     [java] at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
     [java] at sun.net.www.http.HttpClient.New(HttpClient.java:306)
     [java] at sun.net.www.http.HttpClient.New(HttpClient.java:323)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:860)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:726)
     [java] at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
     [java] at java.net.URL.openStream(URL.java:1010)
     [java] at
net.java.sip.communicator.plugin.spellcheck.SpellChecker.setLocale(SpellChecker.java:364)
     [java] at
net.java.sip.communicator.plugin.spellcheck.LanguageMenuBar$SetSpellChecker.construct(LanguageMenuBar.java:589)
     [java] at
net.java.sip.communicator.util.swing.SwingWorker$2.run(SwingWorker.java:161)
     [java] at java.lang.Thread.run(Thread.java:637)

Boris

P.S. I just noticed that the youtube url replacement doesn't work here
aswell, apparently for the same reason (NoRouteToHostException
exception thrown from
net.java.sip.communicator.impl.replacement.youtube.ReplacementServiceYoutubeImpl.getReplacement(ReplacementServiceYoutubeImpl.java:70))