You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Rico Neubauer (Jira)" <ji...@apache.org> on 2019/09/16 11:44:00 UTC

[jira] [Updated] (ARTEMIS-2490) JournalStorageManager#parseLargeMessage may produce fatal issue when reading ORIG_ID

     [ https://issues.apache.org/jira/browse/ARTEMIS-2490?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rico Neubauer updated ARTEMIS-2490:
-----------------------------------
    Description: 
Preface: Found the issue initially with HornetQ and Stacktrace below is from HornetQ, but checked Artemis and issue there exists in the same manner.

If there is a large-message in journal, this gets parsed on startup while doing initialization.
 While doing that property "__AMQ_ORIG_MESSAGE_ID_" (in HornetQ "HQ" instead of "AMQ") is always read, _for compatibility_ according to code.

Problem with that: In case the property does not hold a number, but sth. like "_ID:c6e2e3..._", then a NumberFormatException is thrown, which falls thru the entire initialization mechanism and leads to a non-functioning server.

I have no idea, who sets this "ID:" prefix, but seems internally, since we have no code doing this.
 Mabye this whole compatibility code is not needed anymore - cannot say though.

What I would like to request:
 # Move the retrieval of the property inside the compatibility-block in org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage - since it is not needed otherwise and already avoids the issue in the vast majority where no compatibility must be done.
 # In addition, a check for the "ID:" prefix and removing it before parsing to Long.

See PR for both.

Just fyi: the fix for HornetQ: [Github|https://github.com/seeburger-ag/hornetq/commit/8ef99744f219b23d76803435201e4af33a53b3c5]

 Stacktrace (as said: based on HornetQ code, but class- and method-names are the same):
{code:java}
Failure in initialisation: java.lang.NumberFormatException: For input string: "ID:c6e2e367-d77e-11e9-9471-005056b7cdce"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Long.parseLong(Long.java:589)
    at java.lang.Long.parseLong(Long.java:631)
    at org.hornetq.utils.TypedProperties.getLongProperty(TypedProperties.java:330)
    at org.hornetq.core.message.impl.MessageImpl.getLongProperty(MessageImpl.java:762)
    at org.hornetq.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage(JournalStorageManager.java:1764)
    at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:953)
    at org.hornetq.core.server.impl.HornetQServerImpl.loadJournals(HornetQServerImpl.java:1603)
    at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1445)
    at org.hornetq.core.server.impl.HornetQServerImpl.access$1200(HornetQServerImpl.java:138)
    at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:1919)
    at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:366)
    at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:269)
{code}
 

 

  was:
Preface: Found the issue initially with HornetQ and Stacktrace below is from HornetQ, but checked Artemis and issue there exists in the same manner.

If there is a large-message in journal, this gets parsed on startup while doing initialization.
While doing that property "__AMQ_ORIG_MESSAGE_ID_" (in HornetQ "HQ" instead of "AMQ") is always read, _for compatibility_ according to code.

Problem with that: In case the property does not hold a number, but sth. like "_ID:c6e2e3..._", then a NumberFormatException is thrown, which falls thru the entire initialization mechanism and leads to a non-functioning server.

I have no idea, who sets this "ID:" prefix, but seems internally, since we have no code doing this.
Mabye this whole compatibility code is not needed anymore - cannot say though.

What I would like to request:
 # Move the retrieval of the property inside the compatibility-block in org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage - since it is not needed otherwise and already avoids the issue in the vast majority where no compatibility must be done.
 # In addition, a check for the "ID:" prefix and removing it before parsing to Long.

See PR for both.

Just fyi: the fix for HornetQ: [Github|https://github.com/seeburger-ag/hornetq/commit/8ef99744f219b23d76803435201e4af33a53b3c5]

 
{noformat}
Failure in initialisation: java.lang.NumberFormatException: For input string: "ID:c6e2e367-d77e-11e9-9471-005056b7cdce"Failure in initialisation: java.lang.NumberFormatException: For input string: "ID:c6e2e367-d77e-11e9-9471-005056b7cdce" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Long.parseLong(Long.java:589) at java.lang.Long.parseLong(Long.java:631) at org.hornetq.utils.TypedProperties.getLongProperty(TypedProperties.java:330) at org.hornetq.core.message.impl.MessageImpl.getLongProperty(MessageImpl.java:762) at org.hornetq.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage(JournalStorageManager.java:1764) at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:953) at org.hornetq.core.server.impl.HornetQServerImpl.loadJournals(HornetQServerImpl.java:1603) at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1445) at org.hornetq.core.server.impl.HornetQServerImpl.access$1200(HornetQServerImpl.java:138) at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:1919) at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:366) at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:269){noformat}
 


> JournalStorageManager#parseLargeMessage may produce fatal issue when reading ORIG_ID
> ------------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-2490
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-2490
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>    Affects Versions: 2.10.0
>            Reporter: Rico Neubauer
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Preface: Found the issue initially with HornetQ and Stacktrace below is from HornetQ, but checked Artemis and issue there exists in the same manner.
> If there is a large-message in journal, this gets parsed on startup while doing initialization.
>  While doing that property "__AMQ_ORIG_MESSAGE_ID_" (in HornetQ "HQ" instead of "AMQ") is always read, _for compatibility_ according to code.
> Problem with that: In case the property does not hold a number, but sth. like "_ID:c6e2e3..._", then a NumberFormatException is thrown, which falls thru the entire initialization mechanism and leads to a non-functioning server.
> I have no idea, who sets this "ID:" prefix, but seems internally, since we have no code doing this.
>  Mabye this whole compatibility code is not needed anymore - cannot say though.
> What I would like to request:
>  # Move the retrieval of the property inside the compatibility-block in org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage - since it is not needed otherwise and already avoids the issue in the vast majority where no compatibility must be done.
>  # In addition, a check for the "ID:" prefix and removing it before parsing to Long.
> See PR for both.
> Just fyi: the fix for HornetQ: [Github|https://github.com/seeburger-ag/hornetq/commit/8ef99744f219b23d76803435201e4af33a53b3c5]
>  Stacktrace (as said: based on HornetQ code, but class- and method-names are the same):
> {code:java}
> Failure in initialisation: java.lang.NumberFormatException: For input string: "ID:c6e2e367-d77e-11e9-9471-005056b7cdce"
>     at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
>     at java.lang.Long.parseLong(Long.java:589)
>     at java.lang.Long.parseLong(Long.java:631)
>     at org.hornetq.utils.TypedProperties.getLongProperty(TypedProperties.java:330)
>     at org.hornetq.core.message.impl.MessageImpl.getLongProperty(MessageImpl.java:762)
>     at org.hornetq.core.persistence.impl.journal.JournalStorageManager.parseLargeMessage(JournalStorageManager.java:1764)
>     at org.hornetq.core.persistence.impl.journal.JournalStorageManager.loadMessageJournal(JournalStorageManager.java:953)
>     at org.hornetq.core.server.impl.HornetQServerImpl.loadJournals(HornetQServerImpl.java:1603)
>     at org.hornetq.core.server.impl.HornetQServerImpl.initialisePart2(HornetQServerImpl.java:1445)
>     at org.hornetq.core.server.impl.HornetQServerImpl.access$1200(HornetQServerImpl.java:138)
>     at org.hornetq.core.server.impl.HornetQServerImpl$SharedStoreLiveActivation.run(HornetQServerImpl.java:1919)
>     at org.hornetq.core.server.impl.HornetQServerImpl.start(HornetQServerImpl.java:366)
>     at org.hornetq.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:269)
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.2#803003)