[
https://issues.apache.org/jira/browse/ARTEMIS-4739?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17839761#comment-17839761
]
Justin Bertram commented on ARTEMIS-4739:
-----------------------------------------
If {{messageCompressed}} is {{true}} then an {{InflaterInputStream}} instance
is created with *wraps* the previously created {{ByteArrayInputStream}}. Then
{{DataInputStream}} *wraps* the {{InflaterInputStream}} so that when {{close}}
is invoked on the {{DataInputStream}} then it is invoked in turn on the
{{InflaterInputStream}} and then on the {{ByteArrayInputStream}} which means
*there is no leak*.
It's also worth noting that the {{ByteArrayInputStream}} implementation of
{{close}} is empty so even if {{ByteArrayInputStream.close}} wasn't invoked it
wouldn't be a big deal.
> HANDLE LEAK in OpenWireMessageConverter.java
> --------------------------------------------
>
> Key: ARTEMIS-4739
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4739
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Galkin Alexey
> Priority: Major
>
> The handle tis, which is an object of type InflaterInputStream([line 233
> |https://github.com/apache/activemq-artemis/blob/main/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java]),
> is created in the code and used to read data from contents([line
> 231|https://github.com/apache/activemq-artemis/blob/main/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java]).
> However, if the messageCompressed condition is true, then an
> InflaterInputStream object will be created based on tis, and tis will be
> overwritten with a new InflaterInputStream object. The problem occurs on
> [line
> 237|https://github.com/apache/activemq-artemis/blob/main/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireMessageConverter.java]
> because only the DataInputStream tdataIn is closed, but tis is not closed
> explicitly. This may result in resource leakage and unavailability of
> resources associated with the InflaterInputStream.
> Found by Linux Verification Center (portal.linuxtesting.ru) with SVACE.
> Author Alexey Galkin.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)