Bug 1182466

Summary: Unit test FileSystemDeploymentServiceUnitTestCase fails on IBM JDK
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Marek Kopecky <mkopecky>
Component: TestsuiteAssignee: Emmanuel Hugonnet (ehsavoie) <ehugonne>
Status: CLOSED CURRENTRELEASE QA Contact: Marek Kopecky <mkopecky>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.4.0CC: adinn, brian.stansberry, cdewolf, kkhan, pkremens
Target Milestone: ER2   
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:19 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:

Description Marek Kopecky 2015-01-15 08:25:35 UTC
Description of problem:
 org.jboss.as.server.deployment.scanner.FileSystemDeploymentServiceUnitTestCase.testNoUndeployment fails with:
   - java.net.ConnectException: Connection refused
   - java.lang.UnsupportedOperationException: cannot get the capability, performing dispose of the retransforming environment

Version-Release number of selected component (if applicable):
 EAP 6.4.0.ER1

How reproducible:
 Always on IBM JDK

Steps to Reproduce:
1. ./build.sh -pl deployment-scanner -am   -Dtest=FileSystemDeploymentServiceUnitTestCase -Dmaven.repo.local=${MAVEN_REPO_LOCAL} -DfailIfNoTests=false

Actual results:
 java.net.ConnectException: Connection refused
 java.lang.UnsupportedOperationException: cannot get the capability, performing dispose of the retransforming environment
 java.lang.reflect.InvocationTargetException
 Caused by: java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment

Expected results:
 No failures in test case.

Additional info:
 See for server logs and test output:
  https://jenkins.mw.lab.eng.bos.redhat.com/hudson/job/eap-6x-as-testsuite-FileSystemDeploymentServiceUnitTestCase/3/testReport/

Comment 1 Brian Stansberry 2015-01-15 13:58:46 UTC
Emmanuel,

Please figure out how to disable this test on the IBM JDK, unless getting Byteman to work is easy.

Disabling the test altogether is ok too.

Comment 2 Emmanuel Hugonnet (ehsavoie) 2015-01-16 14:14:57 UTC
Upstream  PR: https://issues.jboss.org/browse/WFCORE-507
PR: https://github.com/jbossas/jboss-eap/pull/2246

Comment 3 Emmanuel Hugonnet (ehsavoie) 2015-01-16 14:15:25 UTC
Disabling for IBM JDK as ByteMan can't attach.

Comment 4 Marek Kopecky 2015-02-10 12:53:30 UTC
Verified on EAP 6.4.0.ER2

Comment 5 Andrew Dinn 2016-04-15 15:47:00 UTC
This is not an isolated occurence of this problem. It has also turned up in Narayana testing. The problem is not that the IBM does not support JVMTI Java agents -- that has been working for some years now. It is more subtle than that.

When using BMUnit for testing the Byetman agent is loading dynamically into the test JVM using the VM_Attach API. The IBM JVM supports that API but rejects loading of the Byteman agent. that's because Byteman asks to installed it's ClassFileTransformer as a Retransformer i.e. with the ability to provide repeated transformations of class files. For some reason the IBM JVM will not accept this request when Byteman is loaded dynamically.

Weirdly, IBM's JVM does accept the request when Byteman is loaded from the java command line using the -javaagent option. That's weird because the agent jar and the code it runs are essentially the same (the premain method which is called at dynamic install simply passes control to the agent main method used to hadle a command line install).

There is an old IBM developer works thread which documents a failure exactly like this one from the command line

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014774211

In that case the probelm is that the agent jar does not set the correct manifest entry. However, that is not hat is at stake here. Byteman /does/ set this manifest entry in the agent jar.

If I can work out who in IBM to talk to I will try to see if I can fix this. Apologies for the lack of service.

n.b. if you want a workaround so you can still run your BMUnit tests on IBM then try the following

1) load Byteman on the JVM command line for the test JVM by passing this option on the java command line: -javaagent:/path/to/byteman.jar=listener:true,boot:/path/to/byteman.jar

2) tell BMUnit not to try loading the agent by passing this setting this property on the test JVM java command line: -Dorg.jboss.byteman.contrib.bmunit.agent.inhibit

3) ensure Byteman allows BMUnit to respond to BMUnitConfig annotation settings by also setting this property on the java command line -Dorg.jboss.byteman.allow.config.update

Step 1) requires you to construct a path in your pom identifying the relevant version of byteman jar (byteman-x.y.z.jar if you depend on version x.y.z) in the maven repo dir (${maven.repo.dir} I think??)