Bug 831649

Summary: Agent tests sporadically fail due to security exceptions
Product: [Other] RHQ Project Reporter: John Sanda <jsanda>
Component: TestsAssignee: RHQ Project Maintainer <rhq-maint>
Status: CLOSED CURRENTRELEASE QA Contact: Mike Foley <mfoley>
Severity: medium Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: hrupp, mazz
Target Milestone: ---   
Target Release: RHQ 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-01 06:00:42 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:

Description John Sanda 2012-06-13 10:07:39 EDT
Description of problem:
Both on jenkins and in local development environment agent tests sporadically fail do to security related exceptions. Here is an example of one of the failures and exceptions,

* failure message:
Failed to send command from agent1 to agent2: Command Response: isSuccessful=[false]; command=[null]; results=[null]; exception=[org.jboss.remoting.CannotConnectException:Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:60003/] -> java.lang.reflect.InvocationTargetException:null -> javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException: No trusted certificate found -> sun.security.validator.ValidatorException:No trusted certificate found]


* stack trace:
java.lang.AssertionError: Failed to send command from agent1 to agent2: Command Response: isSuccessful=[false]; command=[null]; results=[null]; exception=[org.jboss.remoting.CannotConnectException:Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:60003/] -> java.lang.reflect.InvocationTargetException:null -> javax.net.ssl.SSLHandshakeException:sun.security.validator.ValidatorException: No trusted certificate found -> sun.security.validator.ValidatorException:No trusted certificate found]
	at org.rhq.enterprise.agent.AgentComm2Test.testSendSecureMessageClientAuthWantWithTruststore(AgentComm2Test.java:478)


* stdout:
00:13:34,161 ERROR [RHQ Agent Ping Thread-1] (enterprise.communications.command.client.ClientCommandSenderTask) - {ClientCommandSenderTask.send-failed}Failed to send command [Command: type=[remotepojo]; cmd-in-response=[false]; config=[{rhq.agent-name=jboss-on, rhq.externalizable-strategy=AGENT, rhq.security-token=test token, rhq.send-throttle=true}]; params=[{invocation=NameBasedInvocation[ping], targetInterfaceName=org.rhq.core.clientapi.server.core.CoreServerService}]]. Cause: org.jboss.remoting.CannotConnectException:Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:60003/] -> java.net.ConnectException:Connection refused. Cause: org.jboss.remoting.CannotConnectException: Can not get connection to server. Problem establishing socket connection for InvokerLocator [sslsocket://127.0.0.1:60003/]
00:13:34,510 ERROR [WorkerThread#15[127.0.0.1:44368]] (jboss.remoting.transport.socket.ServerThread) - Worker thread initialization failure
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.jboss.remoting.transport.socket.ServerThread.createServerSocketWrapper(ServerThread.java:755)
	at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:375)
	at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: certificate_unknown
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:174)
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:136)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1806)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:986)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1170)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:637)
	at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89)
	at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
	at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
	at java.io.ObjectOutputStream$BlockDataOutputStream.flush(ObjectOutputStream.java:1793)
	at java.io.ObjectOutputStream.flush(ObjectOutputStream.java:699)
	at org.jboss.remoting.marshal.serializable.SerializableMarshaller.getMarshallingStream(SerializableMarshaller.java:90)
	at org.jboss.remoting.marshal.serializable.SerializableMarshaller.getMarshallingStream(SerializableMarshaller.java:72)
	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createOutputStream(ClientSocketWrapper.java:198)
	at org.jboss.remoting.transport.socket.ClientSocketWrapper.createStreams(ClientSocketWrapper.java:161)
	at org.jboss.remoting.transport.socket.ClientSocketWrapper.<init>(ClientSocketWrapper.java:66)
	at org.jboss.remoting.transport.socket.ServerSocketWrapper.<init>(ServerSocketWrapper.java:46)
	... 7 more

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
Comment 1 John Mazzitelli 2012-06-15 14:16:12 EDT
i refactored two agent test methods into their own test classes and things seem to pass now. its possible we can close this. even though I didn't really "fix" anything, I think this worked around the way testng works - and around some quirks of testng that we aren't aware of.
Comment 2 Heiko W. Rupp 2013-09-01 06:00:42 EDT
Bulk closing of items that are on_qa and in old RHQ releases, which are out for a long time and where the issue has not been re-opened since.