Tigase broken on Solaris x64 with jdk1.8.0_40 and later
On Solaris x64 with jdk1.8.0_40 and later, tigase does not accept incoming c2s connections. The log file says:
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.
Added by Christian Kühnke over 3 years ago
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.