[
https://issues.apache.org/jira/browse/ARTEMIS-4462?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17777559#comment-17777559
]
Liviu Citu commented on ARTEMIS-4462:
-------------------------------------
We are using ActiveMQ 5.x Broker with CMS API in our financial software for
more than 10y now (before we used CORBA Orbix). Many of our clients (banks in
top 10 tier) that are using our software have non-ASCII strings (for instance
German/French letters) without any issues and we are *NOT* encoding the
messages in UTF-8 in broker communication.
In the past years we have many requests from our clients to support failover
and also upgrade to Artemis. Hence we are going into this direction. Our
software base code is C++ so we cannot simply switch to Java client. This is
out of discussion because we cannot simply rewrite a software that was millions
on lines of code and many functionalities (integrations with other software,
etc).
Now there are two distinct issues that pop out from our discussion and I would
like not to mix them:
* first issue in CMS API that is not doing the UTF8 conversion before sending
the messages to the broker. I am not sure that it is supposed to do it anyway.
It has some APIs ({*}activemq::util::MarshallingSupport::asciiToModifiedUtf8
and activemq::util::MarshallingSupport::modifiedUtf8ToAscii){*} but they are
NOT doing the correct UTF8 conversion. These APIs are for *Java Modified UTF8*
which is not the same as standard UTF8 that Artemis broker expects. I have done
a simple test but calling *asciiToModifiedUtf8 /* *modifiedUtf8ToAscii* on a
string containing *é* and{*}:{*}
** *asciiToModifiedUtf8* doesn't do anything. the input string does not get
modified{*}{*}
** calling *modifiedUtf8ToAscii* after *asciiToModifiedUtf8* throws
*UTFDataFormatException.* This cannot be right, these functions should work in
pair regardless what kind of conversion they are doing.{*}{*}
I managed to make the message work by using ICU converter. The character in
question has 2 bytes in UTF8 as it should whereas on the client machine using
ISO-88591 encoding has 1 byte.
* second issue (the one I have reported here) is that Artemis Broker is
expecting UTF-8 payload while 5.x broker doesn't. We may have used it wrongly
for so many years but it worked. We know that Java client is doing the
conversion to UTF-8 as we have some Java apps which send message to the Broker
and C++ CMS that is processing them and we had to convert in C++ (only for that
specific app) the message back from UTF8 but t{*}his is Java client who is
doing the conversion{*}. Classic Broker does not expect UTF-8 payload since we
are sending it that way from CMS API for so long and it works.
We cannot simply change the messages from text to bytes because there may be
other (custom client applications) that are processing those messages and they
may expect them to be text.
What we have temporary done was to convert the message to UTF8 before sending
them to Artemis and it works. However this might impact the performance of the
system. We haven't yet officially released our software version supporting
Artemis broker but we want to be prepared to provide explanations to our
clients why this extra step (UTF-8 encoding/decoding) is needed. Clients might
argue that since their Artemis broker is installed on a machine using the same
locale/encoding as all their clients then it does not make sense to perform
extra encoding/decoding. The server should take the messages as they are
received.
> Non-UTF-8 messages containing special characters are not supported
> ------------------------------------------------------------------
>
> Key: ARTEMIS-4462
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4462
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Affects Versions: 2.30.0
> Reporter: Liviu Citu
> Priority: Major
>
> When a text message non-UTF-8 (ISO-8859-15) containing special characters is
> sent from ActiveMQ CPP client to Artemis, an exception
> "java.io.UTFDataFormatException" is seen in Artemis server log.
> Although the exception is thrown as a warning, the message gets rejected by
> the server.
> Below the Artemis server log:
>
> {noformat}
> 2023-09-29 11:34:32,736 WARN
> [org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection]
> Errors occurred during the buffering operation
>
> java.io.UTFDataFormatException: null
> at
> org.apache.activemq.util.MarshallingSupport.convertUTF8WithBuf(MarshallingSupport.java:386)
> ~[activemq-client-5.17.2.jar:5.17.2]
> at
> org.apache.activemq.util.MarshallingSupport.readUTF8(MarshallingSupport.java:358)
> ~[activemq-client-5.17.2.jar:5.17.2]
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter.writeTextType(OpenWireMessageConverter.java:233)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireMessageConverter.inbound(OpenWireMessageConverter.java:128)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.artemis.core.protocol.openwire.amq.AMQSession.send(AMQSession.java:376)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor.processMessage(OpenWireConnection.java:1671)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:769)
> ~[activemq-client-5.17.2.jar:5.17.2]
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.act(OpenWireConnection.java:369)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.artemis.utils.actors.ThresholdActor.doTask(ThresholdActor.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:57)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> [?:?]
> at
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
> [artemis-commons-2.30.0.jar:?]
> 2023-09-29 11:34:32,753 WARN
> [org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection]
> Errors occurred during the buffering operation
> org.apache.activemq.artemis.api.core.ActiveMQException: null
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection$CommandProcessor.processMessage(OpenWireConnection.java:1674)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.command.ActiveMQMessage.visit(ActiveMQMessage.java:769)
> ~[activemq-client-5.17.2.jar:5.17.2]
> at
> org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection.act(OpenWireConnection.java:369)
> ~[artemis-openwire-protocol-2.30.0.jar:2.30.0]
> at
> org.apache.activemq.artemis.utils.actors.ThresholdActor.doTask(ThresholdActor.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:57)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.OrderedExecutor.doTask(OrderedExecutor.java:32)
> ~[artemis-commons-2.30.0.jar:?]
> at
> org.apache.activemq.artemis.utils.actors.ProcessorBase.executePendingTasks(ProcessorBase.java:68)
> ~[artemis-commons-2.30.0.jar:?]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
> [?:?]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
> [?:?]
> at
> org.apache.activemq.artemis.utils.ActiveMQThreadFactory$1.run(ActiveMQThreadFactory.java:118)
> [artemis-commons-2.30.0.jar:?]
> 2023-09-29 11:34:32,755 WARN
> [org.apache.activemq.artemis.core.protocol.openwire.OpenWireConnection]
> Errors occurred during the buffering operation
> java.io.UTFDataFormatException: null
>
> {noformat}
>
> Just create a small test program using ActiveMQ CPP and send a message to
> Artemis containing a french or german specific character.
>
> I have found an old discussion from ActiveMQ Community but it was focused on
> ActiveMQ CPP rather on Artemis.
> [https://lists.apache.org/thread/vywv1gk32mkhvj7sghnvlf7ng5zb1obp]
>
> This is a regression compared with ActiveMQ Classic which does not have this
> issue.
> Does Artemis support non-UTF-8 encoding? Do we need now to encode all
> messages to UTF-8 before sending them to the server? Similarly to decode them
> upon receiving?
> This will cause some problems on our end because:
> * we have many clients already using the ActiveMQ classic and migrating them
> to Artemis will cause issues when migrating KahaDB to Artemis because all the
> messages have to be encoded to UTF-8 otherwise they will not work in Artemis
> * encoding/decoding every message will impact the overall performance. We
> have applications handling thousands of messages every day and conversion of
> these messages will increase the time spent during communication with JMS
> broker
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)