Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
5.16.6
-
None
-
Tested on 5.16.6, Windows client, Windows & Linux servers.
openjdk version "1.8.0_322"
OpenJDK Runtime Environment (Temurin)(build 1.8.0_322-b06)
Description
When a persistent messages is submitted to a queue, with a time to live specified, it should be removed from the queue and (in the default configuration) moved to the DLQ.
This is the case with the web console, and with a trivial Java client using the openwire transport (specified using a "tcp://" broker URL when creating ActiveMQConnectionFactory.
If an http/https url is specified this doesn't behave correctly. When the TTL is exceeded the message seems to go into a limbo state. It doesn't get delivered to consumers, but also doesn't go to the DLQ (as determined via the web console).
The server logs an error when using the web console (stack trace at end):
java.lang.NullPointerException
at org.apache.activemq.command.Message.canProcessAsExpired(Message.java:865)
I believe the cause of the web console issue (and perhaps the whole DLQ thing) is that a transient field, processAsExpired, was added to org.apache.activemq.command.Message, but Message doesn't implement TransientInitializer.
The OpenWire transport doesn't suffer from this as its command unmarshaling code uses a constructor to initialize the ActiveMQTextMessage - so the transient field isn't null.
Stack Trace:
2023-04-30 06:38:00,583 | ERROR | org.apache.activemq.broker.region.Queue | Problem retrieving message for browse | ActiveMQ BrokerService[localhost] Task-2
java.lang.NullPointerException
at org.apache.activemq.command.Message.canProcessAsExpired(Message.java:865)
at org.apache.activemq.broker.region.IndirectMessageReference.canProcessAsExpired(IndirectMessageReference.java:210)
at org.apache.activemq.broker.region.RegionBroker.isExpired(RegionBroker.java:749)
at org.apache.activemq.broker.BrokerFilter.isExpired(BrokerFilter.java:309)
at org.apache.activemq.broker.BrokerFilter.isExpired(BrokerFilter.java:309)
at org.apache.activemq.broker.BrokerFilter.isExpired(BrokerFilter.java:309)
at org.apache.activemq.broker.BrokerFilter.isExpired(BrokerFilter.java:309)
at org.apache.activemq.broker.BrokerFilter.isExpired(BrokerFilter.java:309)
at org.apache.activemq.broker.region.Queue.doBrowseList(Queue.java:1216)
at org.apache.activemq.broker.region.Queue.doBrowse(Queue.java:1196)
at org.apache.activemq.broker.region.Queue.expireMessages(Queue.java:964)
at org.apache.activemq.broker.region.Queue.access$100(Queue.java:108)
at org.apache.activemq.broker.region.Queue$2.run(Queue.java:152)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:750)