Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jms: cleans up artemis code in attempts to deflake test #1394

Merged
merged 1 commit into from
Jan 6, 2024

Conversation

codefromthecrypt
Copy link
Member

This extracts code I started to refactor while trying to get to the bottom of this error on an unrelated PR.

 Error: [ERROR] brave.jakarta.jms.ITJmsTracingMessageConsumer.receive_customSampler -- Time elapsed: 0.028 s <<< ERROR!
[INFO] jakarta.jms.JMSException: AMQ219010: Connection is destroyed
[INFO] 	at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:478)
[INFO] 	at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:452)
[INFO] 	at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:308)
[INFO] 	at org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:256)
[INFO] 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1523)
[INFO] 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:837)
[INFO] 	at org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:341)
[INFO] 	at org.apache.activemq.artemis.jms.client.ActiveMQConnection.authorize(ActiveMQConnection.java:650)
[INFO] 	at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:925)
[INFO] 	at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:290)
[INFO] 	at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:285)
[INFO] 	at brave.jakarta.jms.ArtemisJmsExtension.newConnection(ArtemisJmsExtension.java:69)
[INFO] 	at brave.jakarta.jms.JmsExtension.beforeEach(JmsExtension.java:82)
[INFO] 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
[INFO] 	at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
[INFO] Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ219010: Connection is destroyed]
[INFO] 	... 15 more
[INFO] 

@reta this is on a shared branch, if you can see anything we can do to avoid flakes in activemq, please give a try. Note the failure was in the jarkarta invoker tests, and possibly resource related in CI. If there's a way to make things leaner maybe it will pass. Also, if there'a another MQ we don't need to stick with artemis either. In zipkin and reporter, I moved to docker for reasons like this. However, since this is instrumenting, I'm not sure if we can or not.. I guess we could as we arent' instrumenting the broker... Anyway, if you have some time to give a try, please do as this flake is locking up the project. If we can use docker, yank the ActiveMQExtension from zipkin or reporter and swap it out!

Signed-off-by: Adrian Cole <adrian@tetrate.io>
Copy link
Member Author

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here are some notes in case helps. If you don't have time, I can swing the axe again tomorrow.

here are the places I switched to docker due to flakey embedded servers

https://github.com/openzipkin/zipkin/tree/master/zipkin-collector/activemq/src/test/java/zipkin2/collector/activemq
https://github.com/openzipkin/zipkin-reporter-java/tree/master/activemq-client/src/test/java/zipkin2/reporter/activemq

@@ -40,7 +40,7 @@
* {@link brave.jakarta.jms.ITTracingMessageConsumer}
*/
class ITTracingJMSConsumer extends ITJms {
@RegisterExtension ArtemisJmsExtension jms = new ArtemisJmsExtension();
@RegisterExtension JmsExtension jms = new JmsExtension();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the non-artemis one was dead code in this project

} catch (JMSException e) {
throw new AssertionError(e);
}
}

static class ActiveMQ extends JmsExtension {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was dead code so I flattened the type.

topicConnection.close();
queueSession.close();
queueConnection.close();
if (session != null) session.close();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when the first flake happened, it was obscured by a NPE, so I fixed in both places

@codefromthecrypt
Copy link
Member Author

also, for some reason, in the other PR only the JDK11 run of the jms-jakarta invoker test was flaking, 21 hasn't so far.

@reta
Copy link
Contributor

reta commented Jan 6, 2024

also, for some reason, in the other PR only the JDK11 run of the jms-jakarta invoker test was flaking, 21 hasn't so far.

This is very interesting ... shouldn't be JDK dependent ...

@@ -20,13 +20,14 @@
<modelVersion>4.0.0</modelVersion>

<groupId>@project.groupId@</groupId>
<artifactId>jms40</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that, it was definitely my mistake

import org.apache.activemq.artemis.jms.client.ActiveMQMessage;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;

public abstract class JmsExtension implements BeforeEachCallback, AfterEachCallback {
/**
* ActiveMQ 6 supports JMS 2.0, but requires JDK 17. We have to build on JDK
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 was also aware of that but JDK-17 is indeed a hard requirement

@reta
Copy link
Contributor

reta commented Jan 6, 2024

here are some notes in case helps. If you don't have time, I can swing the axe again tomorrow.

@codefromthecrypt happy to look into that (it may took me a few days), we have fought a few flaky tests in Apache CXF related to Artemis migration

Copy link
Contributor

@reta reta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@codefromthecrypt I was running the tests (from this pull request) for at least an hour continuously and no flaky failures observed so far, this is good cleanup in any case to be merged, thanks!

@codefromthecrypt
Copy link
Member Author

@reta agree to merge this. I'm wondering if CI was having a bad day. In any case, we can revisit later as isn't currently a blocker.

@codefromthecrypt codefromthecrypt merged commit 1de18ef into master Jan 6, 2024
3 checks passed
@codefromthecrypt codefromthecrypt deleted the artemis-debug branch January 6, 2024 23:12
@codefromthecrypt
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants