You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@activemq.apache.org by GitBox <gi...@apache.org> on 2021/09/09 19:34:11 UTC

[GitHub] [activemq-artemis] clebertsuconic commented on a change in pull request #3732: ARTEMIS-3467 FD leak on receiving AMQP large messages

clebertsuconic commented on a change in pull request #3732:
URL: https://github.com/apache/activemq-artemis/pull/3732#discussion_r705638271



##########
File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java
##########
@@ -2738,6 +2749,54 @@ public void testGlobalSizeBytesAndAddressSize(boolean isPage) throws Exception {
       cons.close();
    }
 
+   @Test
+   public void testAMQPLargeMessageFDs() throws Exception {
+      OperatingSystemMXBean os = ManagementFactory.getOperatingSystemMXBean();
+
+      Assume.assumeTrue(os instanceof UnixOperatingSystemMXBean);
+
+      final SimpleString MY_QUEUE = new SimpleString("MY-QUEUE");
+      final int numberOfMessages = 30;
+      ActiveMQServer server = createServer(true, true);
+
+      server.start();
+
+      long fdBefore = ((UnixOperatingSystemMXBean)os).getOpenFileDescriptorCount();
+
+      server.createQueue(new QueueConfiguration(MY_QUEUE).setRoutingType(RoutingType.ANYCAST));
+
+      ConnectionFactory connectionFactory = CFUtil.createConnectionFactory("AMQP", "tcp://localhost:61616");
+      Connection connection = connectionFactory.createConnection();
+      Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+
+      byte[] bufferSample = new byte[300 * 1024];
+
+      for (int i = 0; i < bufferSample.length; i++) {
+         bufferSample[i] = getSamplebyte(i);
+      }
+
+      javax.jms.Queue jmsQueue = session.createQueue(MY_QUEUE.toString());
+
+      MessageProducer producer = session.createProducer(jmsQueue);
+      producer.setTimeToLive(300);
+
+      for (int i = 0; i < numberOfMessages; i++) {
+         BytesMessage message = session.createBytesMessage();
+         message.writeBytes(bufferSample);
+
+         message.setIntProperty("count", i);
+
+         producer.send(message);
+      }
+
+      session.close();
+      connection.close();
+
+      long fdAfter = ((UnixOperatingSystemMXBean)os).getOpenFileDescriptorCount();

Review comment:
       ```suggestion
   Wait.assertEquals(() -> ((UnixOperatingSystemMXBean)os).getOpenFileDescriptorCount() - fdBefore < 3)
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: gitbox-unsubscribe@activemq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org