[
https://issues.apache.org/jira/browse/ARTEMIS-3751?focusedWorklogId=758026&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-758026
]
ASF GitHub Bot logged work on ARTEMIS-3751:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 18/Apr/22 17:38
Start Date: 18/Apr/22 17:38
Worklog Time Spent: 10m
Work Description: clebertsuconic commented on code in PR #4030:
URL: https://github.com/apache/activemq-artemis/pull/4030#discussion_r852284165
##########
tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/amqp/JMSLargeMessageTest.java:
##########
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.activemq.artemis.tests.integration.amqp;
+
+import javax.jms.BytesMessage;
+import javax.jms.Connection;
+import javax.jms.Destination;
+import javax.jms.Message;
+import javax.jms.MessageConsumer;
+import javax.jms.MessageProducer;
+import javax.jms.Session;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import java.util.Random;
+import java.util.zip.Deflater;
+
+import org.junit.Test;
+
+public class JMSLargeMessageTest extends JMSClientTestSupport {
+
+ // https://issues.apache.org/jira/projects/ARTEMIS/issues/ARTEMIS-3751
+ @Test
+ public void
testSendLargeMessageWithCompressionWhenCompressedSizeIsLowerThanLargeMessageSize()
throws Exception {
+ Connection connection = createCoreConnection();
+
+ Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
+ Destination queue = session.createQueue("testQueue");
+
+ MessageProducer producer = session.createProducer(queue);
+ MessageConsumer consumer = session.createConsumer(queue);
+
+ connection.start();
+
+ // What we want is to get a message witch size is larger than client's
minLargeMessageSize (200 kibs here) while compressed the size must be lower
than that
+ // and at same time it must be greater than server minLargeMessageSize
(which is 100 kibs by default)
+ byte[] data = new byte[1024 * 300];
+
+ // We don't want the data to be too random, 42 seems to be a good random
seed
+ new DeflateGenerator(new Random(42), 2.0, 2.0).generate(data, 2);
Review Comment:
>> Deflate in assert is just for checking parameters, if someone decides to
change them. <<
I'm not sure what you meant by this statement. Can you speak in java? :)
Issue Time Tracking
-------------------
Worklog Id: (was: 758026)
Time Spent: 1h (was: 50m)
> Artemis cuts off large bytes messages with compression that exceed the
> minimal large message size
> -------------------------------------------------------------------------------------------------
>
> Key: ARTEMIS-3751
> URL: https://issues.apache.org/jira/browse/ARTEMIS-3751
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Components: JMS
> Affects Versions: 2.18.0, 2.20.0
> Reporter: Alvin Kwekel
> Priority: Major
> Attachments: image-2022-03-30-12-21-21-351.png
>
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Messages are cut off meaning that the message is only partially written to
> the broker. The messages are stored in incomplete form in the
> "large-messages" directory. No exception is thrown. Consumers inevitably
> also get the incomplete partial messages.
>
> To reproduce
> - Message size must exceed the minimal large message size
> - Message size must be less than twice the minimal large message size
> - Minimal large message size must be more than about 1MiB
> - Large message compression must be enabled
> - Message must be a JMS bytes message
> - If messages are smaller than the minimal large message size there is no
> issue
> - If messages are twice as big as the minimal large message size there is no
> issue
> - If the minimal large message size is less than about 1MiB there is no issue
> - If large messages are not compressed there is no issue
> - If the message is a text message there is no issue
> Tested with both Artemis client version 2.18.0 and 2.20.0 while my Artemis
> server is at 2.20.0
> I've created a project that reproduces the issues:
> [https://github.com/alvinkwekel/artemis-large-message-cutoff]
> !image-2022-03-30-12-21-21-351.png!
>
--
This message was sent by Atlassian Jira
(v8.20.1#820001)