Project

General

Profile

Tigase broken on Solaris x64 with jdk1.8.0_40 and later

Christian Kühnke
Added over 3 years ago

On Solaris x64 with jdk1.8.0_40 and later, tigase does not accept incoming c2s connections. The log file says:

2015-06-30 19:55:29.517

[ConnectionOpenThread]

ConnectionOpenThread.run()

INFO: Socket closed instantly after it had been opened?

java.net.SocketException: Invalid argument

    at sun.nio.ch.Net.setIntOption0(Native Method)

    at sun.nio.ch.Net.setSocketOption(Net.java:356)

    at sun.nio.ch.SocketChannelImpl.setOption(SocketChannelImpl.java:179)

    at sun.nio.ch.SocketAdaptor.setIntOption(SocketAdaptor.java:281)

    at sun.nio.ch.SocketAdaptor.setTrafficClass(SocketAdaptor.java:381)

    at tigase.net.ConnectionOpenThread.run(ConnectionOpenThread.java:218)

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

Running tigase on solaris x64 with jdk1.8.0_31 works fine.

Just for your information, if anybody else stumbles over this problem.


Replies (3)

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam over 3 years ago

Thank you for letting us know. Unfortunately we do not have access to Solaris right now, so we cannot investigate or suggest any other workaround.

Added by Christian Kühnke over 3 years ago

That's OK. Unfortunately, Solaris has become a bit exotic lately ;-)

To update on the situation: Still broken with jdk1.8.0_60...

Added by Christian Kühnke over 3 years ago

Hah, I nailed it down! The problem was introduced by the fix for http://bugs.java.com/view_bug.do?bug_id=8062744, which bas backported to jdk8u40 by http://bugs.java.com/view_bug.do?bug_id=8062838.

My understanding (my still be partially wrong):

It adds IP_TOS to the list of (from the java point of view) permissable server socket options, so any IP_TOS option get now passed on to the operating system. Linux does not care about unknown or unsupported socket options whereas Solaris does.

By doing "sc.socket().setTrafficClass(al.getTrafficClass())" in ConnectionOpenThread.java Tigase tries to copy some socket options from another socket, which lead to the following system call:

/20: setsockopt(86, ipv6, IPV6_TCLASS, 0xFFFF80FFBB9FE600, 4, SOV_DEFAULT) Err#22 EINVAL

I am not sure why IPV6 comes into play here, however it is this syscall which leads to the execption.

I also found a workaround: Add "-Djava.net.preferIPv4Stack=true" to the JAVA_OPTIONS in tigase.conf.

    (1-3/3)