Projects tigase _server server-core Issues #1436
ClassCastException on Tigase 7.1.6 and Java 11 (#1436)
Unknown opened 4 years ago

I have a Tigase cluster working for some time, now I decided to migrate to 7.1.6 version (I have some extensions that need changes to fit Tigase 8.x)

I would like to use JDK11 as well since the rest of my platform is in that version and Tigase documentation doesn't suggest it's restricted to JDK8

Tigase-server bootstrap correctly and seems to accept connections and delivering messages.

However, I noticed the migrated server didn't join the cluster. Looking at the logs I can see this:

java.lang.ClassCastException: class java.lang.String cannot be cast to class java.lang.Boolean (java.lang.String and java.lang.Boolean are in module java.base of loader 'bootstrap')
	tigase.cluster.repo.ClConConfigRepository.setProperties(ClConConfigRepository.java:226)
	tigase.cluster.repo.ClConSQLRepository.setProperties(ClConSQLRepository.java:303)
	tigase.cluster.ClusterConnectionManager.setProperties(ClusterConnectionManager.java:897)
	tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:519)
	tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:152)
	tigase.conf.Configurator.componentAdded(Configurator.java:50)
	tigase.conf.Configurator.componentAdded(Configurator.java:33)
	tigase.server.AbstractComponentRegistrator.addComponent(AbstractComponentRegistrator.java:116)
	tigase.server.MessageRouter.addComponent(MessageRouter.java:115)
	tigase.server.MessageRouter.addRouter(MessageRouter.java:152)
	tigase.server.MessageRouter.setProperties(MessageRouter.java:745)
	tigase.conf.ConfiguratorAbstract.setup(ConfiguratorAbstract.java:519)
	tigase.conf.ConfiguratorAbstract.componentAdded(ConfiguratorAbstract.java:152)
	tigase.conf.Configurator.componentAdded(Configurator.java:50)

This seems to happens only with Java11 ... the same 7.1.6 version on Java 8 works.

I would appreciate any advice on how to proceed here.

Are you aware of Tigase-server 7.1.6 having problems with OpenJDK11? Should I stick to JDK8?

Unknown commented 4 years ago

There shouldn't be a problem with running on JDK11.

Can you share your (obfuscated) configuration file (etc/init.properties)? From the stacktrace it seems that you have some error in your configuration (around repo-auto-remove-obsolete-items option). It should has following format:

cl-comp/repo-auto-remove-obsolete-items[B]=true
Unknown commented 4 years ago

Thanks indeed for your prompt response.

Here is the cluster related section:

# Cluster properties
--cluster-mode = true
--s2s-secret = [xxxOBFUSCATEDxxx]
cl-comp/cluster-connections-per-node[I]=2
cl-comp/repo-remove-outdated-items[B]=true
cl-comp/repo-remove-outdated-items=true
cl-comp/repo-autoreload-interval[L]=15
cl-comp/repo-autoreload-interval=15
cl-comp/repo-auto-remove-obsolete-items[B]=true
cl-comp/repo-auto-remove-obsolete-items=true

Here is most of the file

tigase7init.txt

How do you understand that this is related the repo-auto-remove-obsolete-items option from the stacktrace?

Unknown commented 4 years ago

UPDATE

Having

cl-comp/repo-auto-remove-obsolete-items[B]=true
cl-comp/repo-auto-remove-obsolete-items=true

didnt worked then we removed

cl-comp/repo-auto-remove-obsolete-items=true

and now seems working (?!)

... so maybe we should sanitize our config as:

cl-comp/cluster-connections-per-node[I]=2
cl-comp/repo-remove-outdated-items[B]=true
cl-comp/repo-autoreload-interval[L]=15
cl-comp/repo-auto-remove-obsolete-items[B]=true

???

Unknown commented 4 years ago

UPDATE

Using config above the Tigase was able to join the cluster 👍

However I see other weird thing on logs

Apr 16 16:18:47 tigase-xxx-stg-us-central1-qw0l java[26114]: java.util.concurrent.ExecutionException: java.lang.NoSuchMethodError: 'sun.misc.Cleaner sun.nio.ch.DirectBuffer.cleaner()'
Apr 16 16:18:47 tigase-xxx-stg-us-central1-qw0l java[26114]: #011at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
Apr 16 16:18:47 tigase-xxx-stg-us-central1-qw0l java[26114]: #011at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
Apr 16 16:18:47 tigase-xxx-stg-us-central1-qw0l java[26114]: #011at tigase.net.SocketThread$ResultsListener.run(SocketThread.java:568)
Apr 16 16:18:47 tigase-xxx-stg-us-central1-qw0l java[26114]: Caused by: java.lang.NoSuchMethodError: 'sun.misc.Cleaner sun.nio.ch.DirectBuffer.cleaner()'

This might actually be a JDK11 compatibility issue (??) ...

Java 9 and later:
// sun.nio.ch.DirectBuffer methods are not accessible,
// so the new sun.misc.Unsafe.theUnsafe.invokeCleaner(ByteBuffer) is used.
// See https://bugs.openjdk.java.net/browse/JDK-8171377
Unknown commented 4 years ago

I can see at tigase.net.IOUtil.java there is this inner class BufferCache it calling

		private void freeBuffer(ByteBuffer buf) {
			java.lang.ref.Cleaner
			((DirectBuffer) buf).cleaner().clean();
		}

... and this API no longer accessible on JDK9

However I can see that on Tigase 8.0.0 the update of that section of code is just remove it.

Anyway since that exception is not catched within the method, and the method is public I cant foresee which possible effects can produce.

Also it might me think that other possible JDK > 8 problems might be awaiting.

Do you still think we can say Tigase 7.1.6 is JDK11 ready?

It seems to me Tigase 7.1.6 is just fitted for JDK8

wdyt?

Unknown commented 4 years ago

Just to clarify:

cl-comp/repo-auto-remove-obsolete-items[B]=true
cl-comp/repo-auto-remove-obsolete-items=true

is INCORRECT - you can't have two lines about same configuration and init.properties requires specifying value type (i.e. [B])

As for the issue itself - you could try adding -XaddExports:java.base/jdk.internal.ref=ALL-UNNAMED to your java command, which should grant you access to this API.

If not I'd stick with JDK8 or, better yet, update to more recent Tigase version.

Unknown commented 4 years ago

Cool, thanks for the clarification. We will try and get back here with the outcome.

Referenced from commit 1 year ago
issue 1 of 1
Issue Votes (0)
Watchers (0)
Reference
tigase/_server/server-core#1436
Please wait...
Page is in error, reload to recover