Projects tigase _server tigase-utils Issues #7
DNSResolver problem when dealing with IPv6 addresses (#7)
Closed
Artur Hefczyc opened 1 decade ago
Due Date
2014-09-08

Here is the original report from a user on the forums: message#2833

Andrzej Wójcik (Tigase) commented 1 decade ago

I tried to recreate issue but I was unable to do so. I checked code of DNSResovler and each code related to parsing number is properly inside following clause

try { x = Integer.parseInt(z); } catch(Exception ex) {}
so it is impossible to receive NumberFormatException from there as it would be caught already.

I checked DNSResovler against xmpp.org, gmail.com (both have IPv6 addresses) and it worked well. I also checked domain passed for adhoc command to add and it also worked fine (domain resolved only to IPv4 address!) .

I suppose that error might be related to DNS server which is used, which could return SRV record in improper format. I would also suggest to check if DNS SRV records are ok.

Artur Hefczyc commented 1 decade ago

Maybe the bug (and exception) is in the Groovy script validating vhost which is being added, not in the DNSResolver as it was suggested before?

Andrzej Wójcik (Tigase) commented 1 decade ago

I also checked script and VHostItem implementation to find any possible source of this exception but I was unable to identify it. I suppose that in Tigase XMPP Server logs might be more information about this exception including possible source of origin.

Artur Hefczyc commented 1 decade ago

User's comments form the forums:

bq. as the server was executing a groovy admin script, there is no other server log but the stanza itself with the stacktrace being passed around the processoers.

If it helps, the /etc/resolv.conf had the nameservers I've mentioned previously.

Artur Hefczyc commented 1 decade ago

Andrzej,

Is there anything the user could provide that would help you track it down? Maybe some details that would help to replicate the problem locally?

Abmar Barros commented 1 decade ago

two things that might help:

  • I'm running tigase-server-5.2.1-b3461

  • I'm using comp-repo-item-add as it is.

Andrzej Wójcik (Tigase) commented 1 decade ago

I looked once again into this issue and I think I might have found a cause.

I tried to replicate this issue and I was able to replicate it only by setting following property for @InitialDirContext@, example:

env.put("java.naming.provider.url", "dns://2a01:4f8:0:a0a1::add:1010");

which is not valid DNS url, it should be dns://[2a01:4f8:0:a0a1::add:1010] and this causes NumberFormatException in DNS resolution but it is thrown inside Java JDK DNS resolution implementation. Due to this I suppose that tigase.util.DNSResolver implementation is OK and works fine.

I suppose that having this set as system Java property might also cause this issue.

I also tried to check if setting IPv6 address of DNS server in /etc/resolv.conf file might cause this issue and I checked sources of implementation of DNS resolver in OpenJDK (which should be similar to Oracle JDK) but according to implementation there it should work OK.

To investigate it more I would need to see /etc/resolv.conf file from server on which this issue appears and also I would need dump of all System properties of this JVM instance. Also it would be good to know exact implementation and version of JDK which is used by Tigase XMPP Server.

Abmar Barros commented 1 decade ago

/etc/resolv.conf

### Hetzner Online AG installimage
# nameserver config
nameserver 213.133.100.100
nameserver 213.133.98.98
nameserver 213.133.99.99
nameserver 2a01:4f8:0:a111::add:9898
nameserver 2a01:4f8:0:a102::add:9999
nameserver 2a01:4f8:0:a0a1::add:1010

Tigase version

tigase-server-5.2.1-b3461

Java version

java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

System Properties

java.runtime.name: Java(TM) SE Runtime Environment
sun.boot.library.path: /usr/lib/jvm/java-7-oracle/jre/lib/amd64
java.vm.version: 24.65-b04
hardened-mode: true
java.vm.vendor: Oracle Corporation
java.vendor.url: http://java.oracle.com/
path.separator: :
java.vm.name: Java HotSpot(TM) 64-Bit Server VM
file.encoding.pkg: sun.io
user.country: US
sun.java.launcher: SUN_STANDARD
sun.os.patch.level: unknown
admins: hosting-admin@buddycloud.net
test: false
java.vm.specification.name: Java Virtual Machine Specification
user.dir: /opt/tigase-server
java.runtime.version: 1.7.0_67-b01
java.awt.graphicsenv: sun.awt.X11GraphicsEnvironment
java.endorsed.dirs: /usr/lib/jvm/java-7-oracle/jre/lib/endorsed
os.arch: amd64
java.io.tmpdir: /tmp
line.separator: 

java.vm.specification.vendor: Oracle Corporation
os.name: Linux
virt-hosts: buddycloud.net,anon.buddycloud.net
sun.jnu.encoding: UTF-8
java.library.path: /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
property-file: etc/init.properties
s2s-ejabberd-bug-workaround-active: true
user-db-uri: jdbc:postgresql://db01.buddycloud.com:5432/integration_tigase?user=integration_tigase&password=passpass&useUnicode=true&characterEncoding=UTF-8&autoCreateUser=true
debug: server,cert,conf,db,io,net,xml,xmpp,vhosts
java.specification.name: Java Platform API Specification
java.class.version: 51.0
java.net.preferIPv4Stack: true
sun.management.compiler: HotSpot 64-Bit Tiered Compilers
os.version: 3.13.0-29-generic
user.home: /root
user.timezone: Etc/UTC
jdbc.drivers: com.mysql.jdbc.Driver:org.postgresql.Driver:org.apache.derby.jdbc.EmbeddedDriver
java.awt.printerjob: sun.print.PSPrinterJob
file.encoding: UTF-8
java.specification.version: 1.7
java.class.path: /opt/tigase-server/jars/derby.jar:/opt/tigase-server/jars/derbytools.jar:/opt/tigase-server/jars/groovy-all.jar:/opt/tigase-server/jars/hamcrest-core.jar:/opt/tigase-server/jars/javax.servlet.jar:/opt/tigase-server/jars/jdmkrt.jar:/opt/tigase-server/jars/jetty-continuation.jar:/opt/tigase-server/jars/jetty-deploy.jar:/opt/tigase-server/jars/jetty-http.jar:/opt/tigase-server/jars/jetty-io.jar:/opt/tigase-server/jars/jetty-osgi-boot.jar:/opt/tigase-server/jars/jetty-security.jar:/opt/tigase-server/jars/jetty-server.jar:/opt/tigase-server/jars/jetty-servlet.jar:/opt/tigase-server/jars/jetty-util.jar:/opt/tigase-server/jars/jetty-webapp.jar:/opt/tigase-server/jars/jetty-xml.jar:/opt/tigase-server/jars/jstun.jar:/opt/tigase-server/jars/jtds.jar:/opt/tigase-server/jars/jul-to-slf4j.jar:/opt/tigase-server/jars/licence-lib.jar:/opt/tigase-server/jars/logback-classic.jar:/opt/tigase-server/jars/logback-core.jar:/opt/tigase-server/jars/mysql-connector-java.jar:/opt/tigase-server/jars/org.apache.felix.bundlerepository.jar:/opt/tigase-server/jars/org.apache.felix.configadmin.jar:/opt/tigase-server/jars/org.apache.felix.main.jar:/opt/tigase-server/jars/org.apache.felix.shell.jar:/opt/tigase-server/jars/org.apache.felix.shell.remote.jar:/opt/tigase-server/jars/org.osgi.core.jar:/opt/tigase-server/jars/postgresql.jar:/opt/tigase-server/jars/slf4j-api.jar:/opt/tigase-server/jars/tigase-acs-muc.jar:/opt/tigase-server/jars/tigase-acs-pubsub.jar:/opt/tigase-server/jars/tigase-acs.jar:/opt/tigase-server/jars/tigase-extras.jar:/opt/tigase-server/jars/tigase-http-api.jar:/opt/tigase-server/jars/tigase-message-archiving.jar:/opt/tigase-server/jars/tigase-muc.jar:/opt/tigase-server/jars/tigase-pubsub.jar:/opt/tigase-server/jars/tigase-server.jar:/opt/tigase-server/jars/tigase-socks5.jar:/opt/tigase-server/jars/tigase-stats-collector-library.jar:/opt/tigase-server/jars/tigase-stats-collector-provider.jar:/opt/tigase-server/jars/tigase-stun.jar:/opt/tigase-server/jars/tigase-server.jar
user.name: root
comp-name-1: ext
external: cs.buddycloud.net:passpass:listen:5270,media.buddycloud.net:passpass
java.vm.specification.version: 1.7
debug-packages: org.codehaus.groovy
sun.java.command: tigase.server.XMPPServer --property-file etc/init.properties
java.home: /usr/lib/jvm/java-7-oracle/jre
sun.arch.data.model: 64
user.language: en
java.specification.vendor: Oracle Corporation
awt.toolkit: sun.awt.X11.XToolkit
java.vm.info: mixed mode
java.version: 1.7.0_67
comp-class-1: tigase.server.ext.ComponentProtocol
java.ext.dirs: /usr/lib/jvm/java-7-oracle/jre/lib/ext:/usr/java/packages/lib/ext
sun.boot.class.path: /usr/lib/jvm/java-7-oracle/jre/lib/resources.jar:/usr/lib/jvm/java-7-oracle/jre/lib/rt.jar:/usr/lib/jvm/java-7-oracle/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jsse.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jce.jar:/usr/lib/jvm/java-7-oracle/jre/lib/charsets.jar:/usr/lib/jvm/java-7-oracle/jre/lib/jfr.jar:/usr/lib/jvm/java-7-oracle/jre/classes
logback.configurationFile: /opt/tigase-server/etc/logback.xml
java.vendor: Oracle Corporation
file.separator: /
sm-plugins: +jabber:iq:auth,+urn:ietf:params:xml:ns:xmpp+sasl,+urn:ietf:params:xml:ns:xmpp-bind,+urn:ietf:params:xml:ns:xmpp-session,+jabber:iq:register,+jabber:iq:roster,+presence,+jabber:iq:privacy,+jabber:iq:version,+http://jabber.org/protocol/stats,+starttls,+msgoffline,+vcard-temp,+http://jabber.org/protocol/commands,+jabber:iq:private,+urn:xmpp:ping,-basic-filter,-domain-filter,+pep,-zlib
elements-number-limit: 100000
java.vendor.url.bug: http://bugreport.sun.com/bugreport/
vhost-tls-required: true
sun.io.unicode.encoding: UnicodeLittle
sun.cpu.endian: little
user-db: pgsql
sun.cpu.isalist: 
Andrzej Wójcik (Tigase) commented 1 decade ago

After looking at provided content of /etc/resolv.conf and system properties I think that this version of JDK contains bug which causes this issue. This issue is caused by IPv6 address of DNS server in /etc/resolv.conf file which is not properly interpreted by JVM as IPv6 address but as IPv4 address with port. Entry in /etc/resolv.conf is OK as this is how IPv6 address of DNS server should be passed but for unknown reason this version of JDK is not working properly with this entry.

Artur Hefczyc commented 1 decade ago

Have you tried a different version of JDK? Can you recommend a version of JDK that works as a solution to the problem?

Andrzej Wójcik (Tigase) commented 1 decade ago

Unfortunately in my own environment which had IPv6 configured and working lost IPv6 support when I changed hosting provider and current one cannot fix this issue for 3 months now so I could not check support in other JDK versions.

I do not know if our servers have IPv6 configured and if we have any DNS server configured to serve DNS records on IPv6 to verify other JDK versions for this issue.

Right now as a solution I would recommend to remove IPv6 addresses of DNS servers from /etc/resolv.conf file as there are IPv4 addresses pointing to the same DNS servers

Artur Hefczyc commented 1 decade ago

Abmar, please let us know if this helped you solving the problem.

Florian Schmaus commented 10 years ago

For completeness and the record. You tripped over a 4 year old Java bug: https://bugs.openjdk.java.net/browse/JDK-6991580

issue 1 of 1
Type
Bug
Priority
Normal
Assignee
RedmineID
2165
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/tigase-utils#7
Please wait...
Page is in error, reload to recover