Bug 1160683

Summary: NoSuchMethodError during failover with grouping handlers
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Ondřej Kalman <okalman>
Component: HornetQAssignee: Clebert Suconic <csuconic>
Status: CLOSED CURRENTRELEASE QA Contact: Miroslav Novak <mnovak>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: dosoudil, jbertram, kkhan, msvehla
Target Milestone: DR10   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-19 12:46:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1166735    
Attachments:
Description Flags
logfile none

Description Ondřej Kalman 2014-11-05 12:26:40 UTC
Created attachment 954002 [details]
logfile

We are getting this error on JDK 1.6 and 1.7:
java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
	at org.hornetq.core.server.group.impl.LocalGroupingHandler.awaitBindings(LocalGroupingHandler.java:282) [hornetq-server-2.3.23.Final.jar:]
	at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1650) [hornetq-server-2.3.23.Final.jar:]
	at org.hornetq.core.server.impl.HornetQServerImpl.access$1400(HornetQServerImpl.java:178) [hornetq-server-2.3.23.Final.jar:]
	at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreBackupActivation.run(HornetQServerImpl.java:2369) [hornetq-server-2.3.23.Final.jar:]
	at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_35]

Scenario: Two EAP 6.4.0.DR8  servers run in collocated topology with active grouping handlers. Live server1 is LOCAL and backup on server2 is Local, Live server2 is REMOTE and backup server1 is REMOTE
Step1: receiver is connected to live server2 (REMOTE) and waits for messages
Step2: producer connects to live server1 (LOCAL) and starts sending messages with group id
Step3: messsages are routed to REMOTE live server2
Step4: live server1 (LOCAL) is shut down
step5: backup server2 (LOCAL) starts
step6: failover on backup server should be done
step7: backup server (LOCAL) takes care for rest of incoming messages and routes them to live server2 (REMOTE)
step8: receiver received all messages which was sent by producer

Error occurs during step6 or 7 

This exception doesn't occurs on JDK 1.8

Comment 1 Ondřej Kalman 2014-11-05 12:38:19 UTC
Steps to Reproduce:
clone our testsuite from git:
git://git.app.eng.bos.redhat.com/jbossqe/eap-tests-hornetq.git

Go to eap-tests-hornetq/scripts and run groovy script PrepareServers.groovy with -DEAP_VERSION=6.4.0.DR8 parameter:
groovy -DEAP_VERSION=6.4.0.DR8 PrepareServers.groovy

(Script will prepare 4 servers - server1..4 in the directory where are you currently standing.)
create two directories for journal eg.:journal-A and journal-B
Export these paths to server directories + directories for shared journal and mcast addresse.:
export JBOSS_HOME_1=$PWD/server1/jboss-eap
export JBOSS_HOME_2=$PWD/server2/jboss-eap
export JBOSS_HOME_3=$PWD/server3/jboss-eap
export JBOSS_HOME_4=$PWD/server4/jboss-eap
export JOURNAL_DIRECTORY_A=$PWD/journal-A
export JOURNAL_DIRECTORY_A=$PWD/journal-B
export MCAST_ADDR=235.3.4.5

create two empty folders for journals 

And finally: go to jboss-hornetq-testsuite/ in our testsuite and run
mvn clean install -Dtest=ColocatedClusterFailoverTestCase#testGroupingFailoverNodeOneDownSd

Comment 2 Justin Bertram 2014-11-05 18:22:46 UTC
The Groovy script doesn't work for me.  This is what I get:

$ groovy -DEAP_VERSION=6.4.0.DR8 PrepareServers.groovy
Validating Url file:///home/hudson/static_build_env/eap/6.4.0.DR8/jboss-eap-6.4.0.DR8.zip
Url file:///home/hudson/static_build_env/eap/6.4.0.DR8/jboss-eap-6.4.0.DR8.zip does not exists.
Validating Url http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip
Url http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip exists.
eapZipUrl = http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip
patchVersion = null
eapVersion = 6.4.0.DR8
nativesUrl = null
configurationDirUrl = null
eapZipUrlOld  = null
eapVersionOld = null
nativesUrlOld = null
configurationDirUrlOld = null
legacyExtensionUrl = null
   [delete] Deleting directory /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap
Starting download http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip to jboss-eap.zip
Downloaded file http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip to jboss-eap.zip
Unzip jboss-eap.zip into ''
    [unzip] Expanding: /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap.zip into /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts
jboss-eap.zip was unzipped into ''
Trying to get native zip based on eap.zip.url: http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/jboss-eap-6.4.0.DR8.zip
 - base dir is: http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/, eap zip file name is: jboss-eap-6.4.0.DR8.zip
Native platform version is -RHEL6-x86_64Starting download http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/natives/jboss-eap-native-6.4.0.DR8-RHEL6-x86_64.zip to jboss-eap-native.zip
Downloaded file http://download.eng.rdu2.redhat.com/devel/candidates/JBEAP/JBEAP-6.4.0.DR8/natives/jboss-eap-native-6.4.0.DR8-RHEL6-x86_64.zip to jboss-eap-native.zip
Unzip jboss-eap-native.zip into ''
    [unzip] Expanding: /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap-native.zip into /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts
jboss-eap-native.zip was unzipped into ''
Renaming directory jboss-eap-6.4 to jboss-eap
     [move] Moving 997 files to /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap
     [move] Moved 755 empty directories to 9 empty directories under /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap
Modifying default configuration in server: /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap
Copying file /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/tmp.txt to file /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap/standalone/configuration/standalone-full-ha.xml
     [copy] Copying 1 file to /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap/standalone/configuration
Copying file /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/tmp.txt to file /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap/standalone/configuration/standalone-full-ha.xml
     [copy] Copying 1 file to /home/jbertram/failingTestFromQA/eap-tests-hornetq/scripts/jboss-eap/standalone/configuration
Caught: java.lang.CloneNotSupportedException: groovy.util.Node
java.lang.CloneNotSupportedException: groovy.util.Node
	at PrepareServers.cloneProfiles(PrepareServers.groovy:529)
	at PrepareServers.modifyConfiguration(PrepareServers.groovy:403)
	at PrepareServers$modifyConfiguration.callStatic(Unknown Source)
	at PrepareServers.prepareServer(PrepareServers.groovy:190)
	at PrepareServers$prepareServer.call(Unknown Source)
	at PrepareServers.main(PrepareServers.groovy:591)

Here's my Groovy version:

$ groovy --version
Groovy Version: 1.8.6 JVM: 1.7.0_72 Vendor: Oracle Corporation OS: Linux

Regarding the actual problem, I'm having a hard time seeing how this would be failing because the method in question exists in both JDK 1.6 and 1.7.  See http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentHashMap.html#keySet() and http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ConcurrentHashMap.html#keySet() respectively.

Comment 3 Ondřej Kalman 2014-11-06 07:23:45 UTC
Use groovy  version 2.2+ please.

Comment 4 Clebert Suconic 2014-11-06 14:43:09 UTC
Ondrej: Can't you provide a test for us... NoSuchMethodException is by essense an environmental issue.. it's can't be an issue on our code otherwise our code wouldn't have compiled.


I asked Justin to take a look on this thinking it would been a quick thing. But if you have a complex test like this, I'm really inclined to close / ignore this issue.


@Justin: if you can't replicate this quickly / or if it's too hard to run the test... close it as works for me.. Or assign back to Ondrej... we can't fix environmental issues

Comment 5 Justin Bertram 2014-11-06 15:53:01 UTC
I've replicated it.  Investigating further.

Comment 6 Justin Bertram 2014-11-06 16:34:32 UTC
It appears this problem occurs when the code is compiled with JDK 8 targeting Java 6 and then run on Java 6 or 7.  The return type of ConcurrentHashMap#keyset() changed in Java 8 from interface Set<K> to class ConcurrentHashMap.KeySetView<K,V>, which is a type that doesn't exist in either Java 6 or 7.

Is support for Java 8 required?  If not, could HornetQ be compiled with Java 6 or 7?

Comment 8 Justin Bertram 2014-11-06 17:01:46 UTC
I've committed a fix for this on the 2.3.x branch at 94a8d04bdf65e39c7f8884fb3400a7526896d9ea.  Can you try this and if it fixes the issue then I will tag a release for you.

Comment 9 Justin Bertram 2014-11-06 20:02:37 UTC
If you are compiling HornetQ with Java 8 you could simply switch to compiling with Java 6 instead.  As I understand it code compiled with Java 6 should still run on Java 8.  Are you compiling HornetQ with Java 8?

Comment 10 Miroslav Novak 2014-11-07 07:07:47 UTC
EAP 6.4.0 must be certified for JDK 6,7,8. See OS/JVM matrix in [1]. HornetQ jars are prepared by productization team. I have no information about this process. Adding Vladimir to cc. 

[1] https://mojo.redhat.com/docs/DOC-48621#jive_content_id_EAP_640

Comment 11 Miroslav Novak 2014-11-07 08:04:12 UTC
I don't see -rehat-1.jar suffix in HornetQ module. Were HQ jars in EAP 6.4.0.DR8 built by prod team?

Comment 12 Martin Svehla 2014-11-07 10:02:33 UTC
Just to make it clear, EAP is being built with JDK6 but it's required to run on JDK 6/7/8. So I think all this issue was caused by the fact that HornetQ in current EAP 6.4.0.DR8 was accidentally built with JDK8, correct?

Comment 13 Justin Bertram 2014-11-07 14:46:03 UTC
Martin, yes it appears that HornetQ in EAP 6.4.0.DR8 was build with JDK8.

Comment 14 Clebert Suconic 2014-11-08 01:50:48 UTC
i had build a release (dev one) not long ago... without the redhat suffix.

Maybe I've used jdk8 by accident. can you guys replace the buil?

Comment 15 Martin Svehla 2014-11-11 09:23:40 UTC
There's already upgrade BZ for next EAP DRx build (bug 1160614), so I think this issue will get solved by that (as long as you're careful to build with JDK6 if it's non-productized build again).

If the next tag gets postponed, Vladimir promised us to create productized rebuild of current 2.3.23 on JDK6.

So I suggest to leave this BZ for now and wait for next DR build.

Comment 16 Vladimir Dosoudil 2014-11-11 12:47:55 UTC
MEAD build: https://brewweb.devel.redhat.com/taskinfo?taskID=8223129
Prod rebuild PR: https://github.com/jbossas/jboss-eap/pull/1937

Comment 17 Ondřej Kalman 2014-11-19 10:11:48 UTC
Verified with 6.4.0.DR10