From 4cd12ae3d071a34eb551eef9c63fa44e8c6dd118 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 13 May 2024 16:18:16 +0200 Subject: [PATCH 01/52] AMQ-9493: Upgrade to maven-plugin-plugin 3.13.1 (cherry picked from commit 7b49d0c34fecc4061cd6bfc5e9624496e8ee67dc) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6079fd350a..dcf0d55d2b 100644 --- a/pom.xml +++ b/pom.xml @@ -150,7 +150,7 @@ 3.6.1 3.5.0 1.45 - 3.11.0 + 3.13.1 3.8.6 * From 102643edbdddbadc63d9269f7f8a18ca0ea85f2e Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon" Date: Thu, 8 Aug 2024 12:13:17 -0400 Subject: [PATCH 02/52] AMQ-9547 - Remove setLength() and usage from RecoverableRandomAccessFile This method always throws an exception so it should be removed and no longer used. Places in PageFile that called the method have been updated to either remove the usage or throw an error. (cherry picked from commit 5f79b651c225babe62d8742d20e993073faaf1d0) --- .../store/kahadb/disk/page/PageFile.java | 11 +-- .../util/RecoverableRandomAccessFile.java | 4 - .../store/kahadb/disk/page/PageFileTest.java | 83 +++++++++++++------ 3 files changed, 59 insertions(+), 39 deletions(-) diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java index a8f975ed88..a1319278ba 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/page/PageFile.java @@ -423,7 +423,8 @@ public void load() throws IOException, IllegalStateException { } if (writeFile.length() < PAGE_FILE_HEADER_SIZE) { - writeFile.setLength(PAGE_FILE_HEADER_SIZE); + throw new IllegalStateException("File " + file + " is corrupt, length of " + + writeFile.length() + " is less than page file header size of " + PAGE_FILE_HEADER_SIZE); } nextFreePageId.set((writeFile.length() - PAGE_FILE_HEADER_SIZE) / pageSize); @@ -1165,12 +1166,6 @@ private void writeBatch() throws IOException { recoveryFile.write(w.getDiskBound(tmpFilesForRemoval), 0, pageSize); } - // Can we shrink the recovery buffer?? - if (recoveryPageCount > recoveryFileMaxPageCount) { - int t = Math.max(recoveryFileMinPageCount, batch.size()); - recoveryFile.setLength(recoveryFileSizeForPages(t)); - } - // Record the page writes in the recovery buffer. recoveryFile.seek(0); // Store the next tx id... @@ -1262,8 +1257,6 @@ private long redoRecoveryUpdates() throws IOException { if (recoveryFile.length() == 0) { // Write an empty header.. recoveryFile.write(new byte[RECOVERY_FILE_HEADER_SIZE]); - // Preallocate the minium size for better performance. - recoveryFile.setLength(recoveryFileSizeForPages(recoveryFileMinPageCount)); return 0; } diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java index 309272a870..ca392da9db 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/util/RecoverableRandomAccessFile.java @@ -374,10 +374,6 @@ public long length() throws IOException { } } - public void setLength(long length) throws IOException { - throw new IllegalStateException("File size is pre allocated"); - } - public void seek(long pos) throws IOException { try { getRaf().seek(pos); diff --git a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java index 7eceef1f7e..7e8278f5c9 100644 --- a/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java +++ b/activemq-kahadb-store/src/test/java/org/apache/activemq/store/kahadb/disk/page/PageFileTest.java @@ -367,20 +367,44 @@ public boolean isSatisified() throws Exception { public void testRecoveryAfterUncleanShutdownAndZeroFreePages() throws Exception { final int numberOfPages = 1000; final AtomicBoolean recoveryEnd = new AtomicBoolean(); + createRecoveryAppender("testRecoveryAfterUncleanShutdownAndZeroFreePagesAppender", recoveryEnd); - final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getLogger(PageFile.class)); - final var appender = new AbstractAppender("testAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) { - @Override - public void append(LogEvent event) { - if (event.toImmutable().getLevel().equals(Level.INFO) && event.toImmutable().getMessage().getFormattedMessage().contains("Recovered pageFile free list")) { - recoveryEnd.set(true); - } - } - }; - appender.start(); + PageFile pf = new PageFile(new File("target/test-data"), getName()); + pf.delete(); + pf.setEnableRecoveryFile(false); + pf.load(); - logger.addAppender(appender); - logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {}); + LOG.info("Creating Transactions"); + for (int i = 0; i < numberOfPages; i++) { + Transaction tx = pf.tx(); + Page page = tx.allocate(); + String t = "page:" + i; + page.set(t); + tx.store(page, StringMarshaller.INSTANCE, false); + tx.commit(); + } + + pf.flush(); + + assertEquals(pf.getFreePageCount(), 0); + + //Simulate an unclean shutdown + PageFile pf2 = new PageFile(new File("target/test-data"), getName()); + pf2.setEnableRecoveryFile(false); + pf2.load(); + + assertTrue("Recovery Finished", Wait.waitFor(recoveryEnd::get, 100000)); + + //Simulate a clean shutdown + pf2.unload(); + assertTrue(pf2.isCleanShutdown()); + + } + + public void testRecoveryAfterUncleanShutdownAndMissingRecoveryFile() throws Exception { + final int numberOfPages = 1000; + final AtomicBoolean recoveryEnd = new AtomicBoolean(); + createRecoveryAppender("testRecoveryAfterUncleanShutdownAndMissingRecoveryFileAppender", recoveryEnd); PageFile pf = new PageFile(new File("target/test-data"), getName()); pf.delete(); @@ -403,7 +427,10 @@ public void append(LogEvent event) { //Simulate an unclean shutdown PageFile pf2 = new PageFile(new File("target/test-data"), getName()); - pf2.setEnableRecoveryFile(false); + pf2.setEnableRecoveryFile(true); + + // Simulate a missing recovery file + pf2.getRecoveryFile().delete(); pf2.load(); assertTrue("Recovery Finished", Wait.waitFor(recoveryEnd::get, 100000)); @@ -417,19 +444,7 @@ public void append(LogEvent event) { public void testBackgroundWillMarkUsedPagesAsFreeInTheBeginning() throws Exception { final int numberOfPages = 100000; final AtomicBoolean recoveryEnd = new AtomicBoolean(); - - final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getLogger(PageFile.class)); - final var appender = new AbstractAppender("pageAppender", new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) { - @Override - public void append(LogEvent event) { - if (event.toImmutable().getLevel().equals(Level.INFO) && event.toImmutable().getMessage().getFormattedMessage().contains("Recovered pageFile free list")) { - recoveryEnd.set(true); - } - } - }; - appender.start(); - logger.addAppender(appender); - logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {}); + createRecoveryAppender("testBackgroundWillMarkUsedPagesAsFreeInTheBeginningAppender", recoveryEnd); PageFile pf = new PageFile(new File("target/test-data"), getName()); pf.delete(); @@ -519,4 +534,20 @@ public boolean isSatisified() throws Exception { assertEquals("pages freed during recovery should be reused", numberOfPages, totalPages); } + + private void createRecoveryAppender(String name, AtomicBoolean recoveryEnd) { + final var logger = org.apache.logging.log4j.core.Logger.class.cast(LogManager.getLogger(PageFile.class)); + final var appender = new AbstractAppender(name, new AbstractFilter() {}, new MessageLayout(), false, new Property[0]) { + @Override + public void append(LogEvent event) { + if (event.toImmutable().getLevel().equals(Level.INFO) && event.toImmutable().getMessage().getFormattedMessage().contains("Recovered pageFile free list")) { + recoveryEnd.set(true); + } + } + }; + appender.start(); + + logger.addAppender(appender); + logger.get().addAppender(appender, Level.DEBUG, new AbstractFilter() {}); + } } From 2f44e8d52615be51cb6622aff82ab43d6f37121a Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon" Date: Wed, 28 Aug 2024 12:44:45 -0400 Subject: [PATCH 03/52] AMQ-8398 - Fix Stomp to OpenWire UTF-8 translation This commit fixes conversion of messages that are sent or received using Stomp when the body contains characters that require 4 bytes for encoding using standard UTF-8. ActiveMQ and OpenWire currently use a modified UTF-8 encoding that only uses 3 bytes so the conversion previously was breaking because the body was encoded using standard JDK UTF-8 encoding and set directly on an ActiveMQText message which was leading to decoding errors later when the ActiveMQMessage tried to decode using the modified encoder. The reverse was also was true and was breaking in some cases. The fix now makes sure to correctly decode the Stomp message back to a String first and set that on the ActiveMQ message so it can be re-encoded correctly. The reverse is fixed as well so both conversion from Stomp -> OpenWire and OpenWire -> Stomp work. Tests have been added for Stomp -> OpenWire, OpenWire -> Stomp, and Stomp -> Stomp which is really Stomp -> OpenWire -> Stomp. (cherry picked from commit 3ddf5155973f46b080ad4500000281e06ad8c372) --- .../stomp/LegacyFrameTranslator.java | 40 ++++------ .../activemq/transport/stomp/StompFrame.java | 7 +- .../activemq/transport/stomp/StompTest.java | 78 +++++++++++++++++++ 3 files changed, 93 insertions(+), 32 deletions(-) diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java index 38eab6fc77..0c6ee175f5 100644 --- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java +++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/LegacyFrameTranslator.java @@ -18,6 +18,7 @@ import java.io.DataOutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.HashMap; import java.util.Map; @@ -53,12 +54,9 @@ public ActiveMQMessage convertFrame(ProtocolConverter converter, StompFrame comm if(intendedType.equalsIgnoreCase("text")){ ActiveMQTextMessage text = new ActiveMQTextMessage(); try { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(command.getContent().length + 4); - DataOutputStream data = new DataOutputStream(bytes); - data.writeInt(command.getContent().length); - data.write(command.getContent()); - text.setContent(bytes.toByteSequence()); - data.close(); + // AMQ-8398 - get the original text back so we decode from standard UTF-8 + // and set on the message so it will re-encode using AMQ modified UTF-8 + text.setText(command.getBody()); } catch (Throwable e) { throw new ProtocolException("Text could not bet set: " + e, false, e); } @@ -78,12 +76,9 @@ public ActiveMQMessage convertFrame(ProtocolConverter converter, StompFrame comm } else { ActiveMQTextMessage text = new ActiveMQTextMessage(); try { - ByteArrayOutputStream bytes = new ByteArrayOutputStream(command.getContent().length + 4); - DataOutputStream data = new DataOutputStream(bytes); - data.writeInt(command.getContent().length); - data.write(command.getContent()); - text.setContent(bytes.toByteSequence()); - data.close(); + // AMQ-8398 - get the original text back so we decode from standard UTF-8 + // and set on the message so it will re-encode using AMQ modified UTF-8 + text.setText(command.getBody()); } catch (Throwable e) { throw new ProtocolException("Text could not bet set: " + e, false, e); } @@ -103,22 +98,13 @@ public StompFrame convertMessage(ProtocolConverter converter, ActiveMQMessage me FrameTranslator.Helper.copyStandardHeadersFromMessageToFrame(converter, message, command, this); if (message.getDataStructureType() == ActiveMQTextMessage.DATA_STRUCTURE_TYPE) { - - if (!message.isCompressed() && message.getContent() != null) { - ByteSequence msgContent = message.getContent(); - if (msgContent.getLength() > 4) { - byte[] content = new byte[msgContent.getLength() - 4]; - System.arraycopy(msgContent.data, 4, content, 0, content.length); - command.setContent(content); - } - } else { - ActiveMQTextMessage msg = (ActiveMQTextMessage)message.copy(); - String messageText = msg.getText(); - if (messageText != null) { - command.setContent(msg.getText().getBytes("UTF-8")); - } + ActiveMQTextMessage msg = (ActiveMQTextMessage)message.copy(); + // AMQ-8398 - get the original text back so we decode from modified UTF-8 + // and then we can re-encode using the standard JDK encoding + String messageText = msg.getText(); + if (messageText != null) { + command.setContent(msg.getText().getBytes(StandardCharsets.UTF_8)); } - } else if (message.getDataStructureType() == ActiveMQBytesMessage.DATA_STRUCTURE_TYPE) { ActiveMQBytesMessage msg = (ActiveMQBytesMessage)message.copy(); diff --git a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java index d386550881..8304232940 100644 --- a/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java +++ b/activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java @@ -17,6 +17,7 @@ package org.apache.activemq.transport.stomp; import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.HashMap; import java.util.Locale; @@ -75,11 +76,7 @@ public byte[] getContent() { } public String getBody() { - try { - return new String(content, "UTF-8"); - } catch (UnsupportedEncodingException e) { - return new String(content); - } + return new String(content, StandardCharsets.UTF_8); } public void setContent(byte[] data) { diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java index 9f0d65e909..9e3b340325 100644 --- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java +++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java @@ -219,6 +219,84 @@ public void testSendMessage() throws Exception { assertTrue(Math.abs(tnow - tmsg) < 1000); } + // Test that a string that requires 4 bytes to encode using standard + // UTF-8 does not break when sent by Stomp and received by JMS/OpenWire + // AMQ uses a modified UTF-8 encoding that only uses 3 bytes so conversion + // needs to happen so this works. + @Test(timeout = 60000) + public void testSend4ByteUtf8StompToJms() throws Exception { + // Create test string using emojis, requires 4 bytes with standard UTF-8 + String body = "!®౩\uD83D\uDE42"; + MessageConsumer consumer = session.createConsumer(queue); + + String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + frame = stompConnection.receiveFrame(); + assertTrue(frame.startsWith("CONNECTED")); + + // publish message with string that requires 4-byte UTF-8 encoding + frame = "SEND\n" + "destination:/queue/" + getQueueName() + "\n\n" + body + Stomp.NULL; + stompConnection.sendFrame(frame); + + // Verify received message is original sent string + TextMessage message = (TextMessage)consumer.receive(2500); + assertNotNull(message); + assertEquals(body, message.getText()); + } + + // Test that a string that requires 4 bytes to encode using standard + // UTF-8 does not break when sent by JMS/OpenWire and received by Stomp + // AMQ uses a modified UTF-8 encoding that only uses 3 bytes so conversion + // needs to happen so this works. + @Test(timeout = 60000) + public void testSend4ByteUtf8JmsToStomp() throws Exception { + // Create test string using emojis, requires 4 bytes with standard UTF-8 + String body = "!®౩\uD83D\uDE42"; + MessageProducer producer = session.createProducer(queue); + + String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + frame = stompConnection.receiveFrame(); + assertTrue(frame.startsWith("CONNECTED")); + frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + // publish message with string that requires 4-byte UTF-8 encoding + producer.send(session.createTextMessage(body)); + + // Verify received message is original sent string + StompFrame message = stompConnection.receive(); + assertNotNull(message); + assertEquals(body, message.getBody()); + } + + // Test that a string that requires 4 bytes to encode using standard + // UTF-8 does not break when sent by Stomp and received by Stomp + @Test(timeout = 60000) + public void testSend4ByteUtf8StompToStomp() throws Exception { + // Create test string using emojis, requires 4 bytes with standard UTF-8 + String body = "!®౩\uD83D\uDE42"; + + String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + // publish message with string that requires 4-byte UTF-8 encoding + frame = "SEND\n" + "destination:/queue/" + getQueueName() + "\n\n" + body + Stomp.NULL; + stompConnection.sendFrame(frame); + + frame = stompConnection.receiveFrame(); + assertTrue(frame.startsWith("CONNECTED")); + frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; + stompConnection.sendFrame(frame); + + // Verify received message is original sent string + StompFrame message = stompConnection.receive(); + assertNotNull(message); + assertEquals(body, message.getBody()); + } + @Test(timeout = 60000) public void testJMSXGroupIdCanBeSet() throws Exception { From 8860dcebe2054bb00d5ba62f0e0f648e18e0f68e Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon" Date: Wed, 4 Sep 2024 15:33:55 -0400 Subject: [PATCH 04/52] AMQ-8398 - Fix Stomp to Stomp Unicode UTF-8 test The connection receive was out of order and causing failures in some of the Stomp tests like StompNIOSSL (cherry picked from commit f5fb6c91b2f302459ab13b247630d4869ed8ce75) --- .../java/org/apache/activemq/transport/stomp/StompTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java index 9e3b340325..9c82261e32 100644 --- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java +++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompTest.java @@ -281,13 +281,13 @@ public void testSend4ByteUtf8StompToStomp() throws Exception { String frame = "CONNECT\n" + "login:system\n" + "passcode:manager\n\n" + Stomp.NULL; stompConnection.sendFrame(frame); + frame = stompConnection.receiveFrame(); + assertTrue(frame.startsWith("CONNECTED")); // publish message with string that requires 4-byte UTF-8 encoding frame = "SEND\n" + "destination:/queue/" + getQueueName() + "\n\n" + body + Stomp.NULL; stompConnection.sendFrame(frame); - frame = stompConnection.receiveFrame(); - assertTrue(frame.startsWith("CONNECTED")); frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" + "ack:auto\n\n" + Stomp.NULL; stompConnection.sendFrame(frame); From f3cf6685fc4e69bdde1723cb5c684b2dff1733fc Mon Sep 17 00:00:00 2001 From: Aleksei Zotov Date: Wed, 4 Sep 2024 17:53:40 -0400 Subject: [PATCH 05/52] AMQ-8398 - Add missing super.tearDown() call to Stomp NIOSSLLargeMessageTest (cherry picked from commit f914001035b2f1ae3984b11ec134f953406d044f) --- .../activemq/transport/stomp/StompNIOSSLLargeMessageTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompNIOSSLLargeMessageTest.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompNIOSSLLargeMessageTest.java index e4277e2627..21e181a4f0 100644 --- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompNIOSSLLargeMessageTest.java +++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompNIOSSLLargeMessageTest.java @@ -103,6 +103,7 @@ public void setUp() throws Exception { @Override public void tearDown() throws Exception { + super.tearDown(); // unregister Log4J appender org.apache.logging.log4j.core.Logger rootLogger = (org.apache.logging.log4j.core.Logger) org.apache.logging.log4j.LogManager.getRootLogger(); rootLogger.removeAppender(appender); From b1545e21e9b9ebce8b3e1e94e15f34e7a7369bc9 Mon Sep 17 00:00:00 2001 From: Ken Liao Date: Thu, 22 Aug 2024 22:11:29 -0700 Subject: [PATCH 06/52] Set cache-control to no-store by default for stronger security (cherry picked from commit 2dab16172e45d90065fe3aa2be53b59c286908cd) --- assembly/src/release/conf/jetty.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/assembly/src/release/conf/jetty.xml b/assembly/src/release/conf/jetty.xml index 874afeeaef..e475e80810 100644 --- a/assembly/src/release/conf/jetty.xml +++ b/assembly/src/release/conf/jetty.xml @@ -74,6 +74,11 @@ + + + + + From bdc928dcb9f8c390e7c14d8fe49a892fc0b76c9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Tue, 3 Sep 2024 10:04:12 +0200 Subject: [PATCH 07/52] AMQ-9557: Upgrade to commons-logging 1.3.4 (cherry picked from commit 254d0fa159b7720f1817f77cb1b455237096c0df) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dcf0d55d2b..01168242c1 100644 --- a/pom.xml +++ b/pom.xml @@ -53,7 +53,7 @@ 2.12.0 2.16.1 3.14.0 - 1.3.3 + 1.3.4 2.12.0 1.0 2.0.0.AM25 From b21deae573f506911fbb795bb89fbe9dacd40031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 30 May 2024 11:24:47 +0200 Subject: [PATCH 08/52] AMQ-9510: Upgrade to jmock 2.13.1 (cherry picked from 6001e812e792d6eae89e0fb12f4bdf730deaf33a) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 01168242c1..f49887a6b8 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ 3.5.9 9.0.65 1.5.4 - 2.12.0 + 2.13.1 2.0.3 1.5_5 From bf53eb8f3072c82766ff499ac45be5416bb1b4f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Tue, 30 Apr 2024 14:53:04 +0200 Subject: [PATCH 09/52] AMQ-9491: Upgrade to ASM 9.7 (cherry picked from commit f03443ee98d95ae27031e11dab01fa34575b1cbf) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f49887a6b8..a0d7713d51 100644 --- a/pom.xml +++ b/pom.xml @@ -468,7 +468,7 @@ org.ow2.asm asm - 9.6 + 9.7 From 177fe606b4033fa47de237d9c02cda51c07c62ac Mon Sep 17 00:00:00 2001 From: Paul Gale Date: Wed, 28 Aug 2024 11:47:25 -0400 Subject: [PATCH 10/52] Remove JDK_JAVA_OPTIONS usage in wrapper.conf. Moved to wrapper.java.additional.x options. (cherry picked from commit f1379cd613357375b111eda96cae1b41110d009a) --- .../src/release/bin/linux-x86-64/wrapper.conf | 20 ++++++++++++++++--- assembly/src/release/bin/macosx/wrapper.conf | 20 ++++++++++++++++--- assembly/src/release/bin/win64/wrapper.conf | 20 ++++++++++++++++--- 3 files changed, 51 insertions(+), 9 deletions(-) diff --git a/assembly/src/release/bin/linux-x86-64/wrapper.conf b/assembly/src/release/bin/linux-x86-64/wrapper.conf index 09442c88b9..cd1367c6a7 100644 --- a/assembly/src/release/bin/linux-x86-64/wrapper.conf +++ b/assembly/src/release/bin/linux-x86-64/wrapper.conf @@ -25,9 +25,6 @@ set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data -# JDK 9+ modules -set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED - wrapper.working.dir=. # Java Application @@ -63,6 +60,23 @@ wrapper.java.additional.11=-Dactivemq.data=%ACTIVEMQ_DATA% wrapper.java.additional.12=-Djava.security.auth.login.config=%ACTIVEMQ_CONF%/login.config wrapper.java.additional.13=-Djolokia.conf=file:%ACTIVEMQ_CONF%/jolokia-access.xml +## ------------------------------------------------------------------ +## Java Platform Module System (JPMS) - Java 9+. +## ------------------------------------------------------------------ +wrapper.java.additional.20=--add-reads=java.xml=java.logging +wrapper.java.additional.21=--add-opens=java.base/java.security=ALL-UNNAMED +wrapper.java.additional.22=--add-opens=java.base/java.net=ALL-UNNAMED +wrapper.java.additional.23=--add-opens=java.base/java.lang=ALL-UNNAMED +wrapper.java.additional.25=--add-opens=java.base/java.util=ALL-UNNAMED +wrapper.java.additional.26=--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED +wrapper.java.additional.27=--add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED +wrapper.java.additional.28=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED +wrapper.java.additional.29=--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED +wrapper.java.additional.30=--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED +wrapper.java.additional.31=--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED +wrapper.java.additional.32=--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED +wrapper.java.additional.33=--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + # Uncomment to enable jmx #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616 #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false diff --git a/assembly/src/release/bin/macosx/wrapper.conf b/assembly/src/release/bin/macosx/wrapper.conf index 1249663c1f..8ce579b80b 100644 --- a/assembly/src/release/bin/macosx/wrapper.conf +++ b/assembly/src/release/bin/macosx/wrapper.conf @@ -25,9 +25,6 @@ set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data -# JDK 9+ modules -set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED - wrapper.working.dir=. # Java Application @@ -63,6 +60,23 @@ wrapper.java.additional.11=-Dactivemq.data=%ACTIVEMQ_DATA% wrapper.java.additional.12=-Djava.security.auth.login.config=%ACTIVEMQ_CONF%/login.config wrapper.java.additional.13=-Djolokia.conf=file:%ACTIVEMQ_CONF%/jolokia-access.xml +## ------------------------------------------------------------------ +## Java Platform Module System (JPMS) - Java 9+. +## ------------------------------------------------------------------ +wrapper.java.additional.20=--add-reads=java.xml=java.logging +wrapper.java.additional.21=--add-opens=java.base/java.security=ALL-UNNAMED +wrapper.java.additional.22=--add-opens=java.base/java.net=ALL-UNNAMED +wrapper.java.additional.23=--add-opens=java.base/java.lang=ALL-UNNAMED +wrapper.java.additional.25=--add-opens=java.base/java.util=ALL-UNNAMED +wrapper.java.additional.26=--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED +wrapper.java.additional.27=--add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED +wrapper.java.additional.28=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED +wrapper.java.additional.29=--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED +wrapper.java.additional.30=--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED +wrapper.java.additional.31=--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED +wrapper.java.additional.32=--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED +wrapper.java.additional.33=--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + # Uncomment to enable jmx #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616 #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false diff --git a/assembly/src/release/bin/win64/wrapper.conf b/assembly/src/release/bin/win64/wrapper.conf index 4a49be62b4..68349aa70d 100644 --- a/assembly/src/release/bin/win64/wrapper.conf +++ b/assembly/src/release/bin/win64/wrapper.conf @@ -26,9 +26,6 @@ set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data set.default.JOLOKIA_CONF=file:..\\..\\conf\\jolokia-access.xml -# JDK 9+ modules -set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED - wrapper.working.dir=. # Java Application @@ -64,6 +61,23 @@ wrapper.java.additional.11=-Dactivemq.data="%ACTIVEMQ_DATA%" wrapper.java.additional.12=-Djava.security.auth.login.config="%ACTIVEMQ_CONF%/login.config" wrapper.java.additional.13=-Djolokia.conf="%JOLOKIA_CONF%" +## ------------------------------------------------------------------ +## Java Platform Module System (JPMS) - Java 9+. +## ------------------------------------------------------------------ +wrapper.java.additional.20=--add-reads=java.xml=java.logging +wrapper.java.additional.21=--add-opens=java.base/java.security=ALL-UNNAMED +wrapper.java.additional.22=--add-opens=java.base/java.net=ALL-UNNAMED +wrapper.java.additional.23=--add-opens=java.base/java.lang=ALL-UNNAMED +wrapper.java.additional.25=--add-opens=java.base/java.util=ALL-UNNAMED +wrapper.java.additional.26=--add-opens=java.naming/javax.naming.spi=ALL-UNNAMED +wrapper.java.additional.27=--add-opens=java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED +wrapper.java.additional.28=--add-opens=java.base/sun.nio.ch=ALL-UNNAMED +wrapper.java.additional.29=--add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED +wrapper.java.additional.30=--add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED +wrapper.java.additional.31=--add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED +wrapper.java.additional.32=--add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED +wrapper.java.additional.33=--add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + # Uncomment to enable remote jmx #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.port=1616 #wrapper.java.additional.n=-Dcom.sun.management.jmxremote.authenticate=false From bd992a2b5457ec4f00e5f87f34044860411fd4f1 Mon Sep 17 00:00:00 2001 From: Aleksei Zotov Date: Sat, 31 Aug 2024 12:52:33 -0400 Subject: [PATCH 11/52] AMQ-8122 - Fix DataByteArrayInputStreamTest (cherry picked from commit 736eb467e123be5296a93e81cf208faa6543601d) --- .../util/DataByteArrayOutputStream.java | 1 - .../util/DataByteArrayInputStreamTest.java | 129 +++++++++++++----- .../disk/util/DataByteArrayOutputStream.java | 1 - 3 files changed, 92 insertions(+), 39 deletions(-) diff --git a/activemq-client/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java b/activemq-client/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java index 692fb94a4a..f1aaf2983c 100644 --- a/activemq-client/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java +++ b/activemq-client/src/main/java/org/apache/activemq/util/DataByteArrayOutputStream.java @@ -210,7 +210,6 @@ public void writeUTF(String text) throws IOException { ensureEnoughBuffer((int)(pos + encodedsize + 2)); writeShort((int)encodedsize); - byte[] buffer = new byte[(int)encodedsize]; MarshallingSupport.writeUTFBytesToBuffer(text, (int) encodedsize, buf, pos); pos += encodedsize; } diff --git a/activemq-client/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java b/activemq-client/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java index 632bfa30a2..f21260d9d8 100644 --- a/activemq-client/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java +++ b/activemq-client/src/test/java/org/apache/activemq/util/DataByteArrayInputStreamTest.java @@ -17,66 +17,121 @@ package org.apache.activemq.util; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThrows; +import java.io.UTFDataFormatException; import org.junit.Test; +/** + * https://issues.apache.org/jira/browse/AMQ-1911 + * https://issues.apache.org/jira/browse/AMQ-8122 + */ public class DataByteArrayInputStreamTest { - /** - * https://issues.apache.org/activemq/browse/AMQ-1911 - */ @Test - public void testNonAscii() throws Exception { - doMarshallUnMarshallValidation("mei\u00DFen"); + public void testOneByteCharacters() throws Exception { + testCodePointRange(0x000000, 0x00007F); + } - String accumulator = new String(); + @Test + public void testTwoBytesCharacters() throws Exception { + testCodePointRange(0x000080, 0x0007FF); + } - int test = 0; // int to get Supplementary chars - while(Character.isDefined(test)) { - String toTest = String.valueOf((char)test); - accumulator += toTest; - doMarshallUnMarshallValidation(toTest); - test++; - } + @Test + public void testThreeBytesCharacters() throws Exception { + testCodePointRange(0x000800, 0x00FFFF); + } - int massiveThreeByteCharValue = 0x0FFF; - String toTest = String.valueOf((char)massiveThreeByteCharValue); - accumulator += toTest; - doMarshallUnMarshallValidation(String.valueOf((char)massiveThreeByteCharValue)); - - // Altogether - doMarshallUnMarshallValidation(accumulator); - - // the three byte values - char t = '\u0800'; - final char max = '\uffff'; - accumulator = String.valueOf(t); - while (t < max) { - String val = String.valueOf(t); - accumulator += val; + @Test + public void testFourBytesCharacters() throws Exception { + testCodePointRange(0x010000, 0X10FFFF); + } + + @Test + public void testFourBytesCharacterEncodedAsBytes() throws Exception { + // Currently ActiveMQ does not properly support 4-bytes UTF characters. + // Ideally, this test should be failing. The current logic was kept as is + // intentionally. See https://issues.apache.org/jira/browse/AMQ-8398. + + // 0xF0 0x80 0x80 0x80 (first valid 4-bytes character) + testInvalidCharacterBytes(new byte[]{-16, -128, -128, -128}, 4); + // 0xF7 0xBF 0xBF 0xBF (last valid 4-bytes character) + testInvalidCharacterBytes(new byte[]{-9, -65, -65, -65}, 4); + } + + + private void testCodePointRange(int from, int to) throws Exception { + StringBuilder accumulator = new StringBuilder(); + for (int codePoint = from; codePoint <= to; codePoint++) { + String val = String.valueOf(Character.toChars(codePoint)); + accumulator.append(val); doMarshallUnMarshallValidation(val); - t++; } - // Altogether so long as it is not too big - while (accumulator.length() > 20000) { - accumulator = accumulator.substring(20000); + // truncate string to last 20k characters + if (accumulator.length() > 20_000) { + doMarshallUnMarshallValidation(accumulator.substring( + accumulator.length() - 20_000)); + } else { + doMarshallUnMarshallValidation(accumulator.toString()); } - doMarshallUnMarshallValidation(accumulator); } - void doMarshallUnMarshallValidation(String value) throws Exception { + private void doMarshallUnMarshallValidation(String value) throws Exception { DataByteArrayOutputStream out = new DataByteArrayOutputStream(); - out.writeBoolean(true); out.writeUTF(value); out.close(); DataByteArrayInputStream in = new DataByteArrayInputStream(out.getData()); - in.readBoolean(); String readBack = in.readUTF(); + assertEquals(value, readBack); } + @Test + public void testTwoBytesOutOfRangeCharacter() throws Exception { + // 0xC0 0x7F + testInvalidCharacterBytes(new byte[]{-64, 127}, 2); + // 0xDF 0xC0 + testInvalidCharacterBytes(new byte[]{-33, -64}, 2); + } + + @Test + public void testThreeBytesOutOfRangeCharacter() throws Exception { + // 0xE0 0x80 0x7F + testInvalidCharacterBytes(new byte[]{-32, -128, 127}, 3); + // 0xEF 0xBF 0xC0 + testInvalidCharacterBytes(new byte[]{-17, -65, -64}, 3); + } + + @Test + public void testFourBytesOutOfRangeCharacter() throws Exception { + // 0xF0 0x80 0x80 0x7F + testInvalidCharacterBytes(new byte[]{-16, -128, -128, 127}, 4); + // 0xF7 0xBF 0xBF 0xC0 + testInvalidCharacterBytes(new byte[]{-9, -65, -65, -64}, 4); + } + + private void testInvalidCharacterBytes(byte[] bytes, int encodedSize) throws Exception { + // Java guarantees that strings are always UTF-8 compliant and valid, + // any invalid sequence of bytes is either replaced or removed. + // This test demonstrates that Java takes care about and does not allow + // anything to break. + String val = new String(bytes); + doMarshallUnMarshallValidation(val); + + // However, a non-java client can send an invalid sequence of bytes. + // Such data causes exceptions while unmarshalling. + DataByteArrayOutputStream out = new DataByteArrayOutputStream(); + out.writeShort(encodedSize); + out.write(bytes); + out.close(); + + DataByteArrayInputStream in = new DataByteArrayInputStream(out.getData()); + assertThrows(UTFDataFormatException.class, () -> in.readUTF()); + } + @Test public void testReadLong() throws Exception { DataByteArrayOutputStream out = new DataByteArrayOutputStream(8); @@ -87,4 +142,4 @@ public void testReadLong() throws Exception { long readBack = in.readLong(); assertEquals(Long.MAX_VALUE, readBack); } -} +} \ No newline at end of file diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DataByteArrayOutputStream.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DataByteArrayOutputStream.java index 5a3fba4715..595726b8cd 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DataByteArrayOutputStream.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/disk/util/DataByteArrayOutputStream.java @@ -237,7 +237,6 @@ public void writeUTF(String text) throws IOException { ensureEnoughBuffer((int)(pos + encodedsize + 2)); writeShort((int)encodedsize); - byte[] buffer = new byte[(int)encodedsize]; MarshallingSupport.writeUTFBytesToBuffer(text, (int) encodedsize, buf, pos); pos += encodedsize; onWrite(); From b074fd13ebfadbbaecf223c873c785c846821e0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Wed, 11 Sep 2024 11:36:48 +0200 Subject: [PATCH 12/52] AMQ-9568: Upgrade to ant 1.10.15 (cherry picked from commit a86cee6df332949769d992e642aa3381ce14b004) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a0d7713d51..acd539cc1e 100644 --- a/pom.xml +++ b/pom.xml @@ -43,7 +43,7 @@ 1.1 1.3 0.1.0 - 1.10.14 + 1.10.15 1.1.0 1.0-M3-dev 4.4.3 From 9a50af7b1a4cf589faf9ff8fc071ba04b3b14db7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Wed, 11 Sep 2024 16:51:02 +0200 Subject: [PATCH 13/52] AMQ-9567: Upgrade to jmdns 3.5.12 (cherry picked from commit ada40417d102d2135388399cf34c0292ca5592b5) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index acd539cc1e..1946c8978e 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ 2.3.2_1 11.0.24 [11,13) - 3.5.9 + 3.5.12 9.0.65 1.5.4 2.13.1 From 789cb9c7eab6ca84585b8953378ebf7db62b648f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 13 May 2024 16:19:37 +0200 Subject: [PATCH 14/52] AMQ-9494: Upgrade to maven-source-plugin 3.3.1 (cherry-picked from commit 7bc8b67fe03a4695c6dd4ed0e333c418b2c99a74) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1946c8978e..ca4a9f74ff 100644 --- a/pom.xml +++ b/pom.xml @@ -132,7 +132,7 @@ 3.12.1 3.0.0 3.3.0 - 3.3.0 + 3.3.1 3.6.3 2.5.2 3.5.1 From 3bf6d495a1e1a5a94ec11c7286184e52f61081b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 13 May 2024 16:40:47 +0200 Subject: [PATCH 15/52] AMQ-9495: Upgrade to maven-assembly-plugin 3.7.1 (cherry picked from commit 1428cf83fbdb711dd4ba16626cd68eb71303a295) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ca4a9f74ff..a5e8403a4b 100644 --- a/pom.xml +++ b/pom.xml @@ -123,7 +123,7 @@ 5.1.9 3.2.5 3.1.0 - 3.6.0 + 3.7.1 3.3.2 3.0.1 2.10 From 2c62c6485edb72b74afad7b21df87f2aff18cc2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 27 May 2024 09:30:12 +0200 Subject: [PATCH 16/52] AMQ-9496: Upgrade to maven-compiler-plugin 3.13.0 (cherry picked from commit 3d36570181ecac43897ae968352aba71614dc527) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a5e8403a4b..25015b402d 100644 --- a/pom.xml +++ b/pom.xml @@ -129,7 +129,7 @@ 2.10 3.4.1 3.4.0 - 3.12.1 + 3.13.0 3.0.0 3.3.0 3.3.1 From bb18dec091bb95e2246439a5f2143b2095bd6f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 08:22:36 +0200 Subject: [PATCH 17/52] AMQ-9576: Upgrade to maven-clean-plugin 3.4.0 (cherry picked from fba0a2e16e394fca01899b97fec41093f0084d2d) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 25015b402d..fa73c70d65 100644 --- a/pom.xml +++ b/pom.xml @@ -124,7 +124,7 @@ 3.2.5 3.1.0 3.7.1 - 3.3.2 + 3.4.0 3.0.1 2.10 3.4.1 From ad35f0022b3564e241fc191e8a7981419f2ccb1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 08:17:32 +0200 Subject: [PATCH 18/52] AMQ-9574: Upgrade to commons-io 2.17.0 (cherry picked from commit c33cdaf0ba2a4ee85c0f922ef724a703c2b2a407) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index fa73c70d65..779fa2cb6f 100644 --- a/pom.xml +++ b/pom.xml @@ -51,7 +51,7 @@ 3.2.2-TT.1 1.4.0 2.12.0 - 2.16.1 + 2.17.0 3.14.0 1.3.4 2.12.0 From 70d2f8c9a8f1f064b50c2c5caf665f9c8ab6b6e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 11:21:08 +0200 Subject: [PATCH 19/52] AMQ-9577: Upgrade to maven-enforcer-plugin 3.5.0 (cherry picked from commit 50a73f9317c22a19d79b3be354cd5ce787b0360f) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 779fa2cb6f..45975aa410 100644 --- a/pom.xml +++ b/pom.xml @@ -127,7 +127,7 @@ 3.4.0 3.0.1 2.10 - 3.4.1 + 3.5.0 3.4.0 3.13.0 3.0.0 From d76c634f8623488c8001ab0890e1e6bd2082fb54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 11:37:20 +0200 Subject: [PATCH 20/52] AMQ-9579: Upgrade to maven-javadoc-plugin 3.10.0 (cherry picked from commit 4d0eb77639087b4c69c365f31ce104a19810b712) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45975aa410..872f630db9 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ 3.0.0 3.3.0 3.3.1 - 3.6.3 + 3.10.0 2.5.2 3.5.1 3.1.0 From 06490ad7da5badcf9732bab2229098a82dbbc8b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 11:22:23 +0200 Subject: [PATCH 21/52] AMQ-9578: Upgrade to maven-jar-plugin 3.4.2 (cherry picked from commit 86131985508f028907881e81175083f9be1c14f7) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 872f630db9..b0ea7349ea 100644 --- a/pom.xml +++ b/pom.xml @@ -131,7 +131,7 @@ 3.4.0 3.13.0 3.0.0 - 3.3.0 + 3.4.2 3.3.1 3.10.0 2.5.2 From 9f5338f12426b0da87e8b7f12740d7cb4e259bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:22:26 +0200 Subject: [PATCH 22/52] AMQ-9580: Upgrade to maven-project-info-reports-plugin 3.7.0 (cherry picked from commit 4d75b206809ac44b9f0429f365736ba424d9dcbd) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index b0ea7349ea..a5fd379d0b 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ 1.4 1.5.0 3.6.1 - 3.5.0 + 3.7.0 1.45 3.13.1 3.8.6 From f1ed21de0740120ef5c5f6cbebeea751fd3421a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:44:49 +0200 Subject: [PATCH 23/52] AMQ-9581: Upgrade to maven-release-plugin 3.1.1 (cherry picked from commit d2ae90df813101010e3aebb0a9b022617041f791) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index a5fd379d0b..18c2762fc8 100644 --- a/pom.xml +++ b/pom.xml @@ -125,7 +125,7 @@ 3.1.0 3.7.1 3.4.0 - 3.0.1 + 3.1.1 2.10 3.5.0 3.4.0 From a1ea7babb567d290918708cb6baff3ee3c0075ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:46:16 +0200 Subject: [PATCH 24/52] AMQ-9582: Upgrade to maven-surefire-plugin 3.5.0 (cherry picked from commit ee271b6da6bc2941763030f4a7da7abee5ef41ee) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 18c2762fc8..87ac0fb83f 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ 5.1.9 - 3.2.5 + 3.5.0 3.1.0 3.7.1 3.4.0 From ebde181e2962c647734a1ad978f128cf8fb9b749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:53:53 +0200 Subject: [PATCH 25/52] AMQ-9583: Upgrade to build-helper-maven-plugin 3.6.0 (cherry picked from commit ccfb85f6235849f9932f6cb879d513f58f6c8096) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 87ac0fb83f..74d1dad0b4 100644 --- a/pom.xml +++ b/pom.xml @@ -142,7 +142,7 @@ 3.0.1 2.7 3.0.0 - 3.5.0 + 3.6.0 1.5.3 0.16.1 1.4 From cc7ff5d333653b85dcbdfc80cf4c13eeac2b58eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:55:34 +0200 Subject: [PATCH 26/52] AMQ-9584: Upgrade to javacc-maven-plugin 3.1.0 (cherry picked from commit d2b4f6fbb1976181433fba75abff3378f79acd86) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 74d1dad0b4..593314ee12 100644 --- a/pom.xml +++ b/pom.xml @@ -139,7 +139,7 @@ 3.1.0 3.0.5 1.6.0 - 3.0.1 + 3.1.0 2.7 3.0.0 3.6.0 From 72be048524f376cdbd68e3a808cf13119d32138b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Mon, 23 Sep 2024 15:57:34 +0200 Subject: [PATCH 27/52] AMQ-9585: Upgrade to taglist-maven-plugin 3.1.0 (cherry picked from commit 47ee619d60dae847369e87a6328b6469a03195d9) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 593314ee12..d224b50b67 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ 1.6.0 3.1.0 2.7 - 3.0.0 + 3.1.0 3.6.0 1.5.3 0.16.1 From d55d3c68aecc1b5d6259f427b4578d75451e1c66 Mon Sep 17 00:00:00 2001 From: Nikita Shupletsov Date: Fri, 18 Oct 2024 15:26:32 -0700 Subject: [PATCH 28/52] [AMQ-9595] Fix recoverNextMessages when there are messages consumed farther than maxBatchSize. (cherry picked from commit 6b08e104208c1a344a1ab8a312450f855415ceb1) --- .../activemq/store/kahadb/KahaDBStore.java | 3 +- .../DurableSubscriptionPartialAckTest.java | 114 ++++++++++++++++++ 2 files changed, 115 insertions(+), 2 deletions(-) create mode 100644 activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionPartialAckTest.java diff --git a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java index bde01d0404..27dfa12718 100644 --- a/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java +++ b/activemq-kahadb-store/src/main/java/org/apache/activemq/store/kahadb/KahaDBStore.java @@ -1198,14 +1198,13 @@ public void execute(Transaction tx) throws Exception { StoredDestination sd = getStoredDestination(dest, tx); sd.orderIndex.resetCursorPosition(); MessageOrderCursor moc = sd.subscriptionCursors.get(subscriptionKey); - SequenceSet subAckPositions = null; + SequenceSet subAckPositions = getSequenceSet(tx, sd, subscriptionKey);; if (moc == null) { LastAck pos = getLastAck(tx, sd, subscriptionKey); if (pos == null) { // sub deleted return; } - subAckPositions = getSequenceSet(tx, sd, subscriptionKey); //If we have ackPositions tracked then compare the first one as individual acknowledge mode //may have bumped lastAck even though there are earlier messages to still consume if (subAckPositions != null && !subAckPositions.isEmpty() diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionPartialAckTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionPartialAckTest.java new file mode 100644 index 0000000000..31776199a9 --- /dev/null +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionPartialAckTest.java @@ -0,0 +1,114 @@ +/** + * 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.usecases; + +import jakarta.jms.Connection; +import jakarta.jms.Message; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; +import jakarta.jms.TextMessage; +import jakarta.jms.TopicSubscriber; +import org.apache.activemq.ActiveMQConnectionFactory; +import org.apache.activemq.ActiveMQSession; +import org.apache.activemq.broker.BrokerFactory; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.command.ActiveMQTextMessage; +import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.util.IOHelper; +import org.junit.Test; + +import java.io.File; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class DurableSubscriptionPartialAckTest { + + private BrokerService createBroker() throws Exception { + BrokerService broker = BrokerFactory.createBroker("broker:(vm://" + getClass().getName() + ")"); + broker.setBrokerName("broker"); + broker.setAdvisorySupport(false); + File dir = broker.getBrokerDataDirectory(); + if (dir != null) { + IOHelper.deleteChildren(dir); + } + return broker; + } + + @Test + public void test() throws Exception { + BrokerService broker = createBroker(); + broker.start(); + broker.waitUntilStarted(); + + ActiveMQTopic topic = new ActiveMQTopic("TOPIC.TEST"); + String subName1 = "SUB1"; + String subName2 = "SUB2"; + int numberOfMessages = 10_000; + + ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(broker.getVmConnectorURI()); + try (Connection connection = connectionFactory.createConnection()) { + connection.setClientID("CLIENT_ID"); + connection.start(); + + Session session = connection.createSession(false, ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE); + + TopicSubscriber subscriber = session.createDurableSubscriber(topic, subName1); + session.createDurableSubscriber(topic, subName2).close(); + + MessageProducer producer = session.createProducer(topic); + + for (int i = 0; i < numberOfMessages; i++) { + ActiveMQTextMessage message = new ActiveMQTextMessage(); + message.setText(Integer.toString(i)); + producer.send(message); + } + + for (int i = 0; i < numberOfMessages; i++) { + Message receivedMessage = subscriber.receive(1000); + assertNotNull(receivedMessage); + assertTrue(receivedMessage instanceof TextMessage); + assertEquals(Integer.toString(i), ((TextMessage) receivedMessage).getText()); + if (i % 2 == 0) { + receivedMessage.acknowledge(); + } + } + } + broker.stop(); + broker.waitUntilStopped(); + broker.start(); + broker.waitUntilStarted(); + try (Connection connection = connectionFactory.createConnection()) { + connection.setClientID("CLIENT_ID"); + connection.start(); + + Session session = connection.createSession(false, ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE); + TopicSubscriber subscriber = session.createDurableSubscriber(topic, subName1); + + for (int i = 1; i < numberOfMessages; i += 2) { + Message receivedMessage = subscriber.receive(10000); + assertNotNull(receivedMessage); + assertTrue(receivedMessage instanceof TextMessage); + assertEquals(Integer.toString(i), ((TextMessage) receivedMessage).getText()); + + receivedMessage.acknowledge(); + } + } + } + +} From f831abf89704415803d3fa5b9aa7709ba96da6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Tue, 29 Oct 2024 09:36:05 +0100 Subject: [PATCH 29/52] AMQ-9614: Upgrade to cxf-xjc-plugin 4.0.2 (cherry picked from commit 175b184eb3f195de364b2dc15fd00b404bdd1d3d) --- activemq-runtime-config/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/activemq-runtime-config/pom.xml b/activemq-runtime-config/pom.xml index 5025d79fd5..39301684c4 100644 --- a/activemq-runtime-config/pom.xml +++ b/activemq-runtime-config/pom.xml @@ -115,7 +115,7 @@ org.apache.cxf cxf-xjc-plugin - 4.0.0 + 4.0.2 compile-xsd From fc689df3bdf2639327c7878606286a3189c85359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Tue, 29 Oct 2024 07:21:29 +0100 Subject: [PATCH 30/52] AMQ-9615: Upgrade to maven-shade-plugin 3.6.0 (cherry picked from commit 82a298db7136ecac0440711c46cd4ff9e3c1a92b) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d224b50b67..1bcaae2794 100644 --- a/pom.xml +++ b/pom.xml @@ -135,7 +135,7 @@ 3.3.1 3.10.0 2.5.2 - 3.5.1 + 3.6.0 3.1.0 3.0.5 1.6.0 From b0776284a721a0c8bdfe463ce8f8207bacdda6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 07:07:51 +0100 Subject: [PATCH 31/52] AMQ-9613: Upgrade to xbean 4.26 (cherry picked from commit 9f6a100a069f59fb6e0b321c550549b4d8ee574d) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1bcaae2794..028b18126e 100644 --- a/pom.xml +++ b/pom.xml @@ -103,7 +103,7 @@ 2.3 1.1.4c 1.4.20 - 4.25 + 4.26 2.12.2 4.0.8 3.1.0 From 39dbfa11cb21a7c8e9258fb9ec886c2eb3b528f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 07:09:25 +0100 Subject: [PATCH 32/52] AMQ-9612: Upgrade to dependency-check-maven 11.0.0 (cherry picked from commit 75114d761b5853129572990aa7df7b95c7b183be) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 028b18126e..3e82633b9a 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ 4.3.7 2.23.1 4.8.1 - 8.4.2 + 11.0.0 1.16 10.16.1.1 6.0.0 From 4820b5740f6e9e2ba67c7ed8cee034cb11cfd783 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 07:21:13 +0100 Subject: [PATCH 33/52] AMQ-9611: Upgrade to taglist-maven-plugin 3.2.1 (cherry picked from commit 0dc6fdb095fa7539e973ca7a8c7c89e6f68b5dff) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3e82633b9a..73d0d70cac 100644 --- a/pom.xml +++ b/pom.xml @@ -141,7 +141,7 @@ 1.6.0 3.1.0 2.7 - 3.1.0 + 3.2.1 3.6.0 1.5.3 0.16.1 From 281b6216aa50ecab17dd99aac258bd21f6df75dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 07:29:08 +0100 Subject: [PATCH 34/52] AMQ-9610: Upgrade to maven-surefire-plugin 3.5.1 (cherry picked from commit 2a884a49c1bc8b9b49f2df6eea1cdecbb4084325) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 73d0d70cac..e23eb923b0 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ 5.1.9 - 3.5.0 + 3.5.1 3.1.0 3.7.1 3.4.0 From 3c48dfe467add3267120407c5217fb4f8828f7f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 07:56:09 +0100 Subject: [PATCH 35/52] AMQ-9609: Upgrade to maven-project-info-reports-plugin 3.8.0 (cherry picked from commit 987805e0fc53c27727bd0a81629e32ad5309b598) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e23eb923b0..3028cfb6fa 100644 --- a/pom.xml +++ b/pom.xml @@ -148,7 +148,7 @@ 1.4 1.5.0 3.6.1 - 3.7.0 + 3.8.0 1.45 3.13.1 3.8.6 From 00d451599524bded70b5b444ddede611d1ba97a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 14:00:05 +0100 Subject: [PATCH 36/52] AMQ-9608: Upgrade to maven-plugin-plugin 3.15.1 (cherry picked from commit 01f3b604bfed7788031eff35335dbe8e9de634d1) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3028cfb6fa..4eaa7075cb 100644 --- a/pom.xml +++ b/pom.xml @@ -150,7 +150,7 @@ 3.6.1 3.8.0 1.45 - 3.13.1 + 3.15.1 3.8.6 * From 3512867820a0d443c0ec685fe6b4ef2df201ab55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 31 Oct 2024 16:04:06 +0100 Subject: [PATCH 37/52] AMQ-9607: Upgrade to maven-javadoc-plugin 3.10.1 (cherry picked from commit d9e3ee9328c3455105b6272f58097bbb0b761c58) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4eaa7075cb..2e7ac46a0a 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ 3.0.0 3.4.2 3.3.1 - 3.10.0 + 3.10.1 2.5.2 3.6.0 3.1.0 From 36c0c90b038ac931eeab4be748269edd95b185ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Fri, 1 Nov 2024 06:42:37 +0100 Subject: [PATCH 38/52] AMQ-9605: Upgrade to ASM 9.7.1 (cherry picked from commit dc998fbeba7c6046a7cc4ab3976669d3b9c08ced) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2e7ac46a0a..6dc0bbc2ba 100644 --- a/pom.xml +++ b/pom.xml @@ -468,7 +468,7 @@ org.ow2.asm asm - 9.7 + 9.7.1 From 0858dfbbb78a602f9be8129802a9b73271b54f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Fri, 1 Nov 2024 06:43:50 +0100 Subject: [PATCH 39/52] AMQ-9604: Upgrade to Camel 4.8.1 (cherry picked from commit d206c53f7a77b200d1405300adff93c21fd1c753) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6dc0bbc2ba..40afca526a 100644 --- a/pom.xml +++ b/pom.xml @@ -46,7 +46,7 @@ 1.10.15 1.1.0 1.0-M3-dev - 4.4.3 + 4.8.1 1.9.4 3.2.2-TT.1 1.4.0 From af0cae10eca0ee01913b69d44f036144edac8fb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Fri, 1 Nov 2024 06:53:25 +0100 Subject: [PATCH 40/52] AMQ-9603: Upgrade to Jackson 2.18.0 (cherry picked from commit b1a18b40732cfcd3f42dcb661c9620160625cfe3) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 40afca526a..959dce2733 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 4.5.14 4.4.16 1.2.0.Beta4 - 2.17.2 + 2.18.0 3.1.0 1.9.3 4.0.5 From 1309348c0208ba5f76f4f7b58b921db6e2b2e9f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Sat, 2 Nov 2024 17:59:03 +0100 Subject: [PATCH 41/52] AMQ-9612: Upgrade to dependency-check-maven 11.1.0 (cherry picked from commit b28d9e6f95cf4339ac8bde9055c3933c4f032039) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 959dce2733..926eba93fd 100644 --- a/pom.xml +++ b/pom.xml @@ -85,7 +85,7 @@ 4.3.7 2.23.1 4.8.1 - 11.0.0 + 11.1.0 1.16 10.16.1.1 6.0.0 From c70c594e3f3f1fa8af43505393c8f925b96d14fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Sat, 2 Nov 2024 18:00:18 +0100 Subject: [PATCH 42/52] AMQ-9603: Upgrade to Jackson 2.18.1 (cherry picked from commit 1fddedaa3588723f3641ee98526ea7ed53ba3c0f) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 926eba93fd..6951e39c16 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 4.5.14 4.4.16 1.2.0.Beta4 - 2.18.0 + 2.18.1 3.1.0 1.9.3 4.0.5 From bc82c8ce6639576e9d2a651b4f4b73fa9d4260cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 7 Nov 2024 08:54:37 +0000 Subject: [PATCH 43/52] Update spring.schemas version in preparation for 6.1.4 release --- activemq-osgi/src/main/resources/META-INF/spring.schemas | 1 + activemq-spring/src/main/resources/META-INF/spring.schemas | 1 + 2 files changed, 2 insertions(+) diff --git a/activemq-osgi/src/main/resources/META-INF/spring.schemas b/activemq-osgi/src/main/resources/META-INF/spring.schemas index f711396f21..8970dd08df 100644 --- a/activemq-osgi/src/main/resources/META-INF/spring.schemas +++ b/activemq-osgi/src/main/resources/META-INF/spring.schemas @@ -89,6 +89,7 @@ http\://activemq.apache.org/schema/core/activemq-core-6.1.0.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.1.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.2.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.3.xsd=activemq.xsd +http\://activemq.apache.org/schema/core/activemq-core-6.1.4.xsd=activemq.xsd http\://camel.apache.org/schema/spring/camel-spring.xsd=camel-spring.xsd diff --git a/activemq-spring/src/main/resources/META-INF/spring.schemas b/activemq-spring/src/main/resources/META-INF/spring.schemas index aaeb52d2a9..ce04dcc5fc 100644 --- a/activemq-spring/src/main/resources/META-INF/spring.schemas +++ b/activemq-spring/src/main/resources/META-INF/spring.schemas @@ -90,6 +90,7 @@ http\://activemq.apache.org/schema/core/activemq-core-6.1.0.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.1.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.2.xsd=activemq.xsd http\://activemq.apache.org/schema/core/activemq-core-6.1.3.xsd=activemq.xsd +http\://activemq.apache.org/schema/core/activemq-core-6.1.4.xsd=activemq.xsd http\://camel.apache.org/schema/osgi/camel-osgi.xsd=camel-osgi.xsd http\://camel.apache.org/schema/spring/camel-spring.xsd=camel-spring.xsd From e3fdd5e470bbfe593b5cb4852952123bf7998d59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 7 Nov 2024 09:18:26 +0000 Subject: [PATCH 44/52] AMQ-9618: Upgrade to velocity 2.4.1 (cherry picked from commit 6a4d9251e8adb84e1d695d14f72bddbb767fd38a) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 6951e39c16..f034accb81 100644 --- a/pom.xml +++ b/pom.xml @@ -100,7 +100,7 @@ 6.1.14 [6,7) 1.2.5 - 2.3 + 2.4.1 1.1.4c 1.4.20 4.26 From 345fd0dcb1bc2fd244dd4dd07df9c75b3d74c5e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 7 Nov 2024 09:24:56 +0000 Subject: [PATCH 45/52] AMQ-9619: Upgrade to groovy 4.0.23 (cherry picked from commit 5bdec7b09d796e2931877fbb0a9abb78fbcb1b8e) --- activemq-openwire-generator/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activemq-openwire-generator/pom.xml b/activemq-openwire-generator/pom.xml index 9f36dd0eff..7cd7158d09 100644 --- a/activemq-openwire-generator/pom.xml +++ b/activemq-openwire-generator/pom.xml @@ -32,12 +32,12 @@ org.apache.groovy groovy - 4.0.6 + 4.0.23 org.apache.groovy groovy-ant - 4.0.6 + 4.0.23 annogen From 8cfabeabfa99c8e42253c681e10a9da335c6a98a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 7 Nov 2024 09:26:22 +0000 Subject: [PATCH 46/52] AMQ-9620: Upgrade to maven-javadoc-plugin 3.11.1 (cherry picked from commit c41acb96a1c1544011b6b3db2dee32e288762dd5) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index f034accb81..1d898d70fc 100644 --- a/pom.xml +++ b/pom.xml @@ -133,7 +133,7 @@ 3.0.0 3.4.2 3.3.1 - 3.10.1 + 3.11.1 2.5.2 3.6.0 3.1.0 From 8a17333c80e8b70a9b890b5ccaa16f9d7ff85eb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Thu, 7 Nov 2024 09:27:30 +0000 Subject: [PATCH 47/52] AMQ-9621: Upgrade to maven-surefire-plugin 3.5.2 (cherry picked from commit 8cab39829e3965f9160d9a7743920f63760cb397) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1d898d70fc..9e99ca17ba 100644 --- a/pom.xml +++ b/pom.xml @@ -121,7 +121,7 @@ 5.1.9 - 3.5.1 + 3.5.2 3.1.0 3.7.1 3.4.0 From af1d8be9b1d4d8fe2ddd44ed2f8ed327420d2220 Mon Sep 17 00:00:00 2001 From: Nikita Shupletsov Date: Tue, 9 Jul 2024 16:44:07 -0700 Subject: [PATCH 48/52] [AMQ-9530] Fix SelectorAwareVirtualTopicInterceptor ClassCastException if next is not Topic. (cherry picked from commit 473267baf862cc65c3c20b90f737036d4f89db29) --- .../virtual/BaseVirtualDestinationFilter.java | 39 ++++++ .../region/virtual/MappedQueueFilter.java | 13 +- .../SelectorAwareVirtualTopicInterceptor.java | 7 +- .../virtual/VirtualTopicInterceptor.java | 3 +- ...picSelectorWithAnotherInterceptorTest.java | 126 ++++++++++++++++++ 5 files changed, 173 insertions(+), 15 deletions(-) create mode 100644 activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java create mode 100644 activemq-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicSelectorWithAnotherInterceptorTest.java diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java new file mode 100644 index 0000000000..82783e5da5 --- /dev/null +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/BaseVirtualDestinationFilter.java @@ -0,0 +1,39 @@ +/* + * 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.broker.region.virtual; + +import org.apache.activemq.broker.region.BaseDestination; +import org.apache.activemq.broker.region.Destination; +import org.apache.activemq.broker.region.DestinationFilter; + +import java.util.Optional; + +public class BaseVirtualDestinationFilter extends DestinationFilter { + + public BaseVirtualDestinationFilter(Destination next) { + super(next); + } + + BaseDestination getBaseDestination(Destination virtualDest) { + if (virtualDest instanceof BaseDestination) { + return (BaseDestination) virtualDest; + } else if (virtualDest instanceof DestinationFilter) { + return ((DestinationFilter) virtualDest).getAdaptor(BaseDestination.class); + } + return null; + } +} diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/MappedQueueFilter.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/MappedQueueFilter.java index 2baa33a398..838e81c0ed 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/MappedQueueFilter.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/MappedQueueFilter.java @@ -16,12 +16,12 @@ */ package org.apache.activemq.broker.region.virtual; +import java.util.Optional; import java.util.Set; import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.broker.region.BaseDestination; import org.apache.activemq.broker.region.Destination; -import org.apache.activemq.broker.region.DestinationFilter; import org.apache.activemq.broker.region.IndirectMessageReference; import org.apache.activemq.broker.region.RegionBroker; import org.apache.activemq.broker.region.Subscription; @@ -34,7 +34,7 @@ * Creates a mapped Queue that can recover messages from subscription recovery * policy of its Virtual Topic. */ -public class MappedQueueFilter extends DestinationFilter { +public class MappedQueueFilter extends BaseVirtualDestinationFilter { private final ActiveMQDestination virtualDestination; @@ -87,15 +87,6 @@ public synchronized void addSubscription(ConnectionContext context, Subscription } } - private BaseDestination getBaseDestination(Destination virtualDest) { - if (virtualDest instanceof BaseDestination) { - return (BaseDestination) virtualDest; - } else if (virtualDest instanceof DestinationFilter) { - return ((DestinationFilter) virtualDest).getAdaptor(BaseDestination.class); - } - return null; - } - @Override public synchronized void removeSubscription(ConnectionContext context, Subscription sub, long lastDeliveredSequenceId) throws Exception { super.removeSubscription(context, sub, lastDeliveredSequenceId); diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/SelectorAwareVirtualTopicInterceptor.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/SelectorAwareVirtualTopicInterceptor.java index 727f79d380..b46e4f45db 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/SelectorAwareVirtualTopicInterceptor.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/SelectorAwareVirtualTopicInterceptor.java @@ -17,9 +17,9 @@ package org.apache.activemq.broker.region.virtual; import org.apache.activemq.broker.Broker; +import org.apache.activemq.broker.region.BaseDestination; import org.apache.activemq.broker.region.Destination; import org.apache.activemq.broker.region.Subscription; -import org.apache.activemq.broker.region.Topic; import org.apache.activemq.command.Message; import org.apache.activemq.filter.BooleanExpression; import org.apache.activemq.filter.MessageEvaluationContext; @@ -41,8 +41,11 @@ public class SelectorAwareVirtualTopicInterceptor extends VirtualTopicIntercepto public SelectorAwareVirtualTopicInterceptor(Destination next, VirtualTopic virtualTopic) { super(next, virtualTopic); + BaseDestination baseDestination = getBaseDestination(next); selectorCachePlugin = (SubQueueSelectorCacheBroker) - ((Topic)next).createConnectionContext().getBroker().getAdaptor(SubQueueSelectorCacheBroker.class); + (baseDestination != null + ? baseDestination.createConnectionContext().getBroker().getAdaptor(SubQueueSelectorCacheBroker.class) + : null); } /** diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java index cdf683c56f..beb77dbf2a 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/virtual/VirtualTopicInterceptor.java @@ -25,7 +25,6 @@ import org.apache.activemq.broker.ConnectionContext; import org.apache.activemq.broker.ProducerBrokerExchange; import org.apache.activemq.broker.region.Destination; -import org.apache.activemq.broker.region.DestinationFilter; import org.apache.activemq.broker.region.Topic; import org.apache.activemq.command.ActiveMQDestination; import org.apache.activemq.command.ActiveMQQueue; @@ -39,7 +38,7 @@ /** * A Destination which implements Virtual Topic */ -public class VirtualTopicInterceptor extends DestinationFilter { +public class VirtualTopicInterceptor extends BaseVirtualDestinationFilter { private final String prefix; private final String postfix; diff --git a/activemq-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicSelectorWithAnotherInterceptorTest.java b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicSelectorWithAnotherInterceptorTest.java new file mode 100644 index 0000000000..a4a9967bed --- /dev/null +++ b/activemq-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicSelectorWithAnotherInterceptorTest.java @@ -0,0 +1,126 @@ +/** + * 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.broker.virtual; + +import jakarta.jms.Destination; +import jakarta.jms.JMSException; +import jakarta.jms.MessageConsumer; +import jakarta.jms.MessageProducer; +import jakarta.jms.Session; +import org.apache.activemq.broker.Broker; +import org.apache.activemq.broker.BrokerService; +import org.apache.activemq.broker.ConnectionContext; +import org.apache.activemq.broker.region.DestinationFilter; +import org.apache.activemq.broker.region.DestinationInterceptor; +import org.apache.activemq.broker.region.virtual.VirtualDestination; +import org.apache.activemq.broker.region.virtual.VirtualDestinationInterceptor; +import org.apache.activemq.broker.region.virtual.VirtualTopic; +import org.apache.activemq.command.ActiveMQDestination; +import org.apache.activemq.command.ActiveMQQueue; +import org.apache.activemq.command.ActiveMQTopic; +import org.apache.activemq.spring.ConsumerBean; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class VirtualTopicSelectorWithAnotherInterceptorTest extends CompositeTopicTest { + + private static final Logger LOG = LoggerFactory.getLogger(VirtualTopicSelectorWithAnotherInterceptorTest.class); + + protected Destination getConsumer1Dsetination() { + return new ActiveMQQueue("Consumer.1.VirtualTopic.TEST"); + } + + protected Destination getConsumer2Dsetination() { + return new ActiveMQQueue("Consumer.2.VirtualTopic.TEST"); + } + + protected Destination getProducerDestination() { + return new ActiveMQTopic("VirtualTopic.TEST"); + } + + @Override + protected void assertMessagesArrived(ConsumerBean messageList1, ConsumerBean messageList2) { + messageList1.assertMessagesArrived(total / 2); + messageList2.assertMessagesArrived(total / 2); + + messageList1.flushMessages(); + messageList2.flushMessages(); + + LOG.info("validate no other messages on queues"); + try { + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); + + Destination destination1 = getConsumer1Dsetination(); + Destination destination2 = getConsumer2Dsetination(); + MessageConsumer c1 = session.createConsumer(destination1, null); + MessageConsumer c2 = session.createConsumer(destination2, null); + c1.setMessageListener(messageList1); + c2.setMessageListener(messageList2); + + + LOG.info("send one simple message that should go to both consumers"); + MessageProducer producer = session.createProducer(getProducerDestination()); + assertNotNull(producer); + + producer.send(session.createTextMessage("Last Message")); + + messageList1.assertMessagesArrived(1); + messageList2.assertMessagesArrived(1); + + } catch (JMSException e) { + e.printStackTrace(); + fail("unexpeced ex while waiting for last messages: " + e); + } + } + + @Override + protected BrokerService createBroker() throws Exception { + // use message selectors on consumers that need to propagate up to the virtual + // topic dispatch so that un matched messages do not linger on subscription queues + messageSelector1 = "odd = 'yes'"; + messageSelector2 = "odd = 'no'"; + + BrokerService broker = new BrokerService(); + broker.setPersistent(false); + + VirtualTopic virtualTopic = new VirtualTopic(); + // the new config that enables selectors on the interceptor + virtualTopic.setSelectorAware(true); + VirtualDestinationInterceptor interceptor = new VirtualDestinationInterceptor(); + interceptor.setVirtualDestinations(new VirtualDestination[]{virtualTopic}); + TestDestinationInterceptor testInterceptor = new TestDestinationInterceptor(); + broker.setDestinationInterceptors(new DestinationInterceptor[]{testInterceptor, interceptor}); + return broker; + } + + private static class TestDestinationInterceptor implements DestinationInterceptor { + + @Override + public org.apache.activemq.broker.region.Destination intercept(org.apache.activemq.broker.region.Destination destination) { + return new DestinationFilter(destination); + } + + @Override + public void remove(org.apache.activemq.broker.region.Destination destination) { + } + + @Override + public void create(Broker broker, ConnectionContext context, ActiveMQDestination destination) throws Exception { + } + } + +} From 6193eec3df48d7e51bda0cb7de177c51caabd2a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Fri, 8 Nov 2024 09:32:26 +0000 Subject: [PATCH 49/52] AMQ-9622: Upgrade to log4j 2.24.1 (cherry picked from commit 20a6b77f2042f5687d815a3eaa0c55d36dfb3c99) --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9e99ca17ba..42a39d81bc 100644 --- a/pom.xml +++ b/pom.xml @@ -83,7 +83,7 @@ 4.13.2 1.3 4.3.7 - 2.23.1 + 2.24.1 4.8.1 11.1.0 1.16 From 3496be9db188269efd4910c7e6b48c10638dd0a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?JB=20Onofr=C3=A9?= Date: Fri, 8 Nov 2024 10:28:29 +0000 Subject: [PATCH 50/52] AMQ-9617: Adjust consumers timeout to avoid race condition on RestTest (cherry picked from commit fa881ad294519f424f0c7500fe4cb30915617e56) --- .../src/test/java/org/apache/activemq/web/RestTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java index 23c096292c..fe383d88d9 100644 --- a/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java +++ b/activemq-web-demo/src/test/java/org/apache/activemq/web/RestTest.java @@ -88,10 +88,10 @@ public void testConsumeAsyncTimeout() throws Exception { // AMQ-9330 - test no 500 error on timeout and instead 204 error Future result = - asyncRequest(httpClient, "http://localhost:" + port + "/message/test?readTimeout=2000&type=queue&clientId=test", new StringBuffer()); + asyncRequest(httpClient, "http://localhost:" + port + "/message/test?readTimeout=1000&type=queue&clientId=test", new StringBuffer()); // try a second request while the first is running, this should get a 500 error since the first is still running and // concurrent access to the same consumer is not allowed - Future errorResult = asyncRequest(httpClient, "http://localhost:" + port + "/message/test?readTimeout=1&type=queue&clientId=test", new StringBuffer()); + Future errorResult = asyncRequest(httpClient, "http://localhost:" + port + "/message/test?readTimeout=10000&type=queue&clientId=test", new StringBuffer()); assertEquals(HttpStatus.INTERNAL_SERVER_ERROR_500, errorResult.get().getResponse().getStatus()); //After the original request finishes, verify 204 and not 500 error assertEquals(HttpStatus.NO_CONTENT_204, result.get().getResponse().getStatus()); From d14f459b6631ada41860140d445c023516b8f239 Mon Sep 17 00:00:00 2001 From: "Christopher L. Shannon" Date: Wed, 20 Nov 2024 12:22:57 -0500 Subject: [PATCH 51/52] AMQ-9625 - Prevent queue messages from becoming stuck Fixes a race condition bug that can lead to a message being missed on dispatch and stuck on a Queue until restart when caching and concurrentStoreAndDispatch are enabled on a Queue and the cache becomes disabled. (cherry picked from commit 7f218fe05d67117573329593a712ec420532810d) --- .../region/cursors/AbstractStoreCursor.java | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/AbstractStoreCursor.java b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/AbstractStoreCursor.java index 71a83acaef..30089e3551 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/AbstractStoreCursor.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/region/cursors/AbstractStoreCursor.java @@ -255,12 +255,20 @@ public synchronized boolean tryAddMessageLast(MessageReference node, long wait) disableCache = true; } - if (disableCache && isCacheEnabled()) { + // AMQ-9625 - use this.cacheEnabled directly because the method isCacheEnabled() is overriden + // to try to re-enable the cache which we don't want at this point as we already skipped + // adding it to the cache + if (disableCache && this.cacheEnabled) { if (LOG.isTraceEnabled()) { LOG.trace("{} - disabling cache on add {} {}", this, node.getMessageId(), node.getMessageId().getFutureOrSequenceLong()); } syncWithStore(node.getMessage()); setCacheEnabled(false); + } else if (!this.cacheEnabled) { + // AMQ-9625 - Verify and wait on previous in flight async messages here if another + // thread triggered the cache to be disabled + // see the waitForAsyncMessage() method and Jira for more info + waitForAsyncMessage(node.getMessage()); } size++; return true; @@ -319,6 +327,11 @@ private void syncWithStore(Message currentAdd) throws Exception { break; } + // AMQ-9625 - If we are disabling the cache and syncing the store then + // we need to wait for task to finish before updating the store batch + // see the waitForAsyncMessage() method and Jira for more info + waitForAsyncMessage(currentAdd); + MessageId candidate = lastCachedIds[ASYNC_ADD]; if (candidate != null) { // ensure we don't skip current possibly sync add b/c we waited on the future @@ -530,4 +543,38 @@ public String toString() { public Subscription getSubscription() { return null; } + + // AMQ-9625 - If the cache is disabled check if we need to wait for an async message + // to finish its task because the message is not being added to the cache. + // Normally, async messages will only be used if the cache is enabled so most of the time + // this check should not find any async messages to wait on if the cache is disabled + // and is basically a noop. + // + // However, while messages are being published, if the memory limit is reached the first + // thread that is adding the message that reaches the limit will disable the cache. + // This means there will be 1 or more potentially outstanding in flight adds that are + // queued up as async writes to the store. + // + // If the cache is disabled, we need to wait for any async message tasks to be + // finished otherwise there is a chance of missing the messages on dispatch + // when the queue pages in the next batch because store writes will finish after + // the store cursor has already moved ahead leading to a stuck message. + private void waitForAsyncMessage(Message node) { + // Note: isRecievedByDFBridge() was repurposed to be used to mark messages that + // are added to the store as async + if (node.getMessage().isRecievedByDFBridge()) { + final Object futureOrLong = node.getMessageId().getFutureOrSequenceLong(); + if (futureOrLong instanceof Future) { + try { + ((Future) futureOrLong).get(); + } catch (Exception exceptionOk) { + // We don't care if we get an exception (cancelled, etc) we just want + // to ensure the task is finished and not pending. + } finally { + LOG.trace("{} - future finished inside waitForAsyncMessage {} {}", this, + node.getMessageId(), futureOrLong); + } + } + } + } } From a3c30b363f22dc619cec95aa7c8ab2fd082bc2ce Mon Sep 17 00:00:00 2001 From: Cesar Hernandez Date: Fri, 29 Nov 2024 12:52:17 -0600 Subject: [PATCH 52/52] Update poms to 6.1.5-TT.1-SNAPSHOT --- activemq-all/pom.xml | 2 +- activemq-amqp/pom.xml | 2 +- activemq-blueprint/pom.xml | 2 +- activemq-broker/pom.xml | 2 +- activemq-cf/pom.xml | 2 +- activemq-client/pom.xml | 2 +- activemq-console/pom.xml | 2 +- activemq-http/pom.xml | 2 +- activemq-jaas/pom.xml | 2 +- activemq-jdbc-store/pom.xml | 2 +- activemq-jms-pool/pom.xml | 2 +- activemq-kahadb-store/pom.xml | 2 +- activemq-karaf-itest/pom.xml | 2 +- activemq-karaf/pom.xml | 2 +- activemq-log4j-appender/pom.xml | 2 +- activemq-mqtt/pom.xml | 2 +- activemq-openwire-generator/pom.xml | 2 +- activemq-openwire-legacy/pom.xml | 2 +- activemq-osgi/pom.xml | 2 +- activemq-pool/pom.xml | 2 +- activemq-ra/pom.xml | 2 +- activemq-rar/pom.xml | 2 +- activemq-run/pom.xml | 2 +- activemq-runtime-config/pom.xml | 2 +- activemq-shiro/pom.xml | 2 +- activemq-spring/pom.xml | 2 +- activemq-stomp/pom.xml | 2 +- activemq-tooling/activemq-joram-jms-tests/pom.xml | 2 +- activemq-tooling/activemq-junit/pom.xml | 2 +- activemq-tooling/activemq-maven-plugin/pom.xml | 2 +- activemq-tooling/activemq-memtest-maven-plugin/pom.xml | 2 +- activemq-tooling/activemq-perf-maven-plugin/pom.xml | 2 +- activemq-tooling/pom.xml | 2 +- activemq-unit-tests/pom.xml | 2 +- activemq-web-console/pom.xml | 2 +- activemq-web-demo/pom.xml | 2 +- activemq-web/pom.xml | 2 +- assembly/pom.xml | 2 +- bom/pom.xml | 2 +- pom.xml | 2 +- 40 files changed, 40 insertions(+), 40 deletions(-) diff --git a/activemq-all/pom.xml b/activemq-all/pom.xml index a7502d57ec..0a19822285 100644 --- a/activemq-all/pom.xml +++ b/activemq-all/pom.xml @@ -14,7 +14,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-all diff --git a/activemq-amqp/pom.xml b/activemq-amqp/pom.xml index ba08f827c3..6063c3c6bf 100644 --- a/activemq-amqp/pom.xml +++ b/activemq-amqp/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-amqp diff --git a/activemq-blueprint/pom.xml b/activemq-blueprint/pom.xml index 256074a00f..8ab6c223f5 100644 --- a/activemq-blueprint/pom.xml +++ b/activemq-blueprint/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-blueprint diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml index 20f2cd68ae..12b777655c 100644 --- a/activemq-broker/pom.xml +++ b/activemq-broker/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-broker diff --git a/activemq-cf/pom.xml b/activemq-cf/pom.xml index 018e6e9ef5..d7c5e0c161 100644 --- a/activemq-cf/pom.xml +++ b/activemq-cf/pom.xml @@ -24,7 +24,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-cf diff --git a/activemq-client/pom.xml b/activemq-client/pom.xml index 63cd1191bc..cdadf421be 100644 --- a/activemq-client/pom.xml +++ b/activemq-client/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-client diff --git a/activemq-console/pom.xml b/activemq-console/pom.xml index a5134aba1c..7abe9b5a31 100644 --- a/activemq-console/pom.xml +++ b/activemq-console/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-console diff --git a/activemq-http/pom.xml b/activemq-http/pom.xml index a098930118..c592f62f5c 100644 --- a/activemq-http/pom.xml +++ b/activemq-http/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-http diff --git a/activemq-jaas/pom.xml b/activemq-jaas/pom.xml index 0e1b8acec3..9614c3d643 100644 --- a/activemq-jaas/pom.xml +++ b/activemq-jaas/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-jaas diff --git a/activemq-jdbc-store/pom.xml b/activemq-jdbc-store/pom.xml index 4fbed75d20..d3cfb2d5db 100644 --- a/activemq-jdbc-store/pom.xml +++ b/activemq-jdbc-store/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-jdbc-store diff --git a/activemq-jms-pool/pom.xml b/activemq-jms-pool/pom.xml index 18c57afd67..9f82933206 100644 --- a/activemq-jms-pool/pom.xml +++ b/activemq-jms-pool/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-jms-pool diff --git a/activemq-kahadb-store/pom.xml b/activemq-kahadb-store/pom.xml index a2947f36f5..a66fa86d28 100644 --- a/activemq-kahadb-store/pom.xml +++ b/activemq-kahadb-store/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-kahadb-store diff --git a/activemq-karaf-itest/pom.xml b/activemq-karaf-itest/pom.xml index c3493a7b15..16320cc032 100644 --- a/activemq-karaf-itest/pom.xml +++ b/activemq-karaf-itest/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-karaf-itest diff --git a/activemq-karaf/pom.xml b/activemq-karaf/pom.xml index 7544ddf220..60d95c7069 100644 --- a/activemq-karaf/pom.xml +++ b/activemq-karaf/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-karaf diff --git a/activemq-log4j-appender/pom.xml b/activemq-log4j-appender/pom.xml index 09b63d2e29..bb482efa1a 100644 --- a/activemq-log4j-appender/pom.xml +++ b/activemq-log4j-appender/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-log4j-appender diff --git a/activemq-mqtt/pom.xml b/activemq-mqtt/pom.xml index 79fba1a88f..36536d2b3b 100644 --- a/activemq-mqtt/pom.xml +++ b/activemq-mqtt/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-mqtt diff --git a/activemq-openwire-generator/pom.xml b/activemq-openwire-generator/pom.xml index 7cd7158d09..461f449b29 100644 --- a/activemq-openwire-generator/pom.xml +++ b/activemq-openwire-generator/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-openwire-generator diff --git a/activemq-openwire-legacy/pom.xml b/activemq-openwire-legacy/pom.xml index 8564ee6907..9872fbcf6a 100644 --- a/activemq-openwire-legacy/pom.xml +++ b/activemq-openwire-legacy/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-openwire-legacy diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml index 82b64c9521..860537679c 100644 --- a/activemq-osgi/pom.xml +++ b/activemq-osgi/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-osgi diff --git a/activemq-pool/pom.xml b/activemq-pool/pom.xml index c916fc4303..47367aae2a 100644 --- a/activemq-pool/pom.xml +++ b/activemq-pool/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-pool diff --git a/activemq-ra/pom.xml b/activemq-ra/pom.xml index 84b5361470..7fefd89faa 100644 --- a/activemq-ra/pom.xml +++ b/activemq-ra/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-ra diff --git a/activemq-rar/pom.xml b/activemq-rar/pom.xml index f1e6bce372..e20fc9ec3e 100644 --- a/activemq-rar/pom.xml +++ b/activemq-rar/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-rar diff --git a/activemq-run/pom.xml b/activemq-run/pom.xml index b8c4395cd3..4fb35f5ab5 100644 --- a/activemq-run/pom.xml +++ b/activemq-run/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-run diff --git a/activemq-runtime-config/pom.xml b/activemq-runtime-config/pom.xml index 39301684c4..c55a7bd3ee 100644 --- a/activemq-runtime-config/pom.xml +++ b/activemq-runtime-config/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-runtime-config diff --git a/activemq-shiro/pom.xml b/activemq-shiro/pom.xml index 558686a092..8a495e2388 100644 --- a/activemq-shiro/pom.xml +++ b/activemq-shiro/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-shiro diff --git a/activemq-spring/pom.xml b/activemq-spring/pom.xml index 642906d3f1..726c7d571f 100644 --- a/activemq-spring/pom.xml +++ b/activemq-spring/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-spring diff --git a/activemq-stomp/pom.xml b/activemq-stomp/pom.xml index 0fe53b59e7..2bbf0441f6 100644 --- a/activemq-stomp/pom.xml +++ b/activemq-stomp/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-stomp diff --git a/activemq-tooling/activemq-joram-jms-tests/pom.xml b/activemq-tooling/activemq-joram-jms-tests/pom.xml index cc7f632ae7..1a5efc49d4 100644 --- a/activemq-tooling/activemq-joram-jms-tests/pom.xml +++ b/activemq-tooling/activemq-joram-jms-tests/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq.tooling activemq-tooling - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-joram-jms-tests diff --git a/activemq-tooling/activemq-junit/pom.xml b/activemq-tooling/activemq-junit/pom.xml index 0b3e280f60..f36666bad4 100644 --- a/activemq-tooling/activemq-junit/pom.xml +++ b/activemq-tooling/activemq-junit/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tooling activemq-tooling - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-junit diff --git a/activemq-tooling/activemq-maven-plugin/pom.xml b/activemq-tooling/activemq-maven-plugin/pom.xml index aa908d2b0e..9ff9fbc4ba 100644 --- a/activemq-tooling/activemq-maven-plugin/pom.xml +++ b/activemq-tooling/activemq-maven-plugin/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tooling activemq-tooling - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-maven-plugin diff --git a/activemq-tooling/activemq-memtest-maven-plugin/pom.xml b/activemq-tooling/activemq-memtest-maven-plugin/pom.xml index 1eb8f05850..261ecd600f 100644 --- a/activemq-tooling/activemq-memtest-maven-plugin/pom.xml +++ b/activemq-tooling/activemq-memtest-maven-plugin/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq.tooling activemq-tooling - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-memtest-maven-plugin diff --git a/activemq-tooling/activemq-perf-maven-plugin/pom.xml b/activemq-tooling/activemq-perf-maven-plugin/pom.xml index 4e6d1d14c7..550c9b21e2 100644 --- a/activemq-tooling/activemq-perf-maven-plugin/pom.xml +++ b/activemq-tooling/activemq-perf-maven-plugin/pom.xml @@ -21,7 +21,7 @@ org.apache.activemq.tooling activemq-tooling - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-perf-maven-plugin diff --git a/activemq-tooling/pom.xml b/activemq-tooling/pom.xml index 53ebfaf681..4d73a74afe 100644 --- a/activemq-tooling/pom.xml +++ b/activemq-tooling/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT org.apache.activemq.tooling diff --git a/activemq-unit-tests/pom.xml b/activemq-unit-tests/pom.xml index ff7ece203c..18c5c46eb0 100644 --- a/activemq-unit-tests/pom.xml +++ b/activemq-unit-tests/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-unit-tests diff --git a/activemq-web-console/pom.xml b/activemq-web-console/pom.xml index 98f2258fda..fa2cc1a165 100644 --- a/activemq-web-console/pom.xml +++ b/activemq-web-console/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-web-console diff --git a/activemq-web-demo/pom.xml b/activemq-web-demo/pom.xml index c8a4652ebf..f659961ad4 100644 --- a/activemq-web-demo/pom.xml +++ b/activemq-web-demo/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-web-demo diff --git a/activemq-web/pom.xml b/activemq-web/pom.xml index 083c071c6b..1f57cfdcc6 100644 --- a/activemq-web/pom.xml +++ b/activemq-web/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-web diff --git a/assembly/pom.xml b/assembly/pom.xml index 94dcbe3c89..cfccebd5d7 100644 --- a/assembly/pom.xml +++ b/assembly/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT apache-activemq diff --git a/bom/pom.xml b/bom/pom.xml index daa00303d4..8bddff73db 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -22,7 +22,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT activemq-bom diff --git a/pom.xml b/pom.xml index 42a39d81bc..eeebf8bd86 100644 --- a/pom.xml +++ b/pom.xml @@ -25,7 +25,7 @@ org.apache.activemq activemq-parent - 6.1.3-TT.4-SNAPSHOT + 6.1.5-TT.1-SNAPSHOT pom ActiveMQ 2005