activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1754) LargeServerMessageImpl.toString() may leak files
Date Tue, 20 Mar 2018 13:42:00 GMT

    [ https://issues.apache.org/jira/browse/ARTEMIS-1754?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16406338#comment-16406338
] 

ASF GitHub Bot commented on ARTEMIS-1754:
-----------------------------------------

Github user clebertsuconic commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1959#discussion_r175767855
  
    --- Diff: artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/LargeServerMessageImpl.java
---
    @@ -347,24 +351,31 @@ public SequentialFile getFile() throws ActiveMQException {
     
        @Override
        public long getPersistentSize() throws ActiveMQException {
    +      return getPersistentSize(false);
    +   }
    +
    +   private long getPersistentSize(boolean keepFileState) throws ActiveMQException {
           long size = super.getPersistentSize();
    -      size += getBodyEncoder().getLargeBodySize();
    +      size += getBodyEncoder(keepFileState).getLargeBodySize();
     
           return size;
        }
    +
        @Override
        public String toString() {
           try {
    -         return "LargeServerMessage[messageID=" + messageID + ",durable=" + isDurable()
+ ",userID=" + getUserID() + ",priority=" + this.getPriority() + ", timestamp=" + toDate(getTimestamp())
+ ",expiration=" + toDate(getExpiration()) + ", durable=" + durable + ", address=" + getAddress()
+ ",size=" + getPersistentSize() + ",properties=" + (properties != null ? properties.toString()
: "") + "]@" + System.identityHashCode(this);
    +         return "LargeServerMessage[messageID=" + messageID + ",durable=" + isDurable()
+ ",userID=" + getUserID() + ",priority=" + this.getPriority() + ", timestamp=" + toDate(getTimestamp())
+ ",expiration=" + toDate(getExpiration()) + ", durable=" + durable + ", address=" + getAddress()
+ ",size=" + getPersistentSize(true) + ",properties=" + (properties != null ? properties.toString()
: "") + "]@" + System.identityHashCode(this);
    --- End diff --
    
    just remove the fileSize from here... and that's the only change you will need.


> LargeServerMessageImpl.toString() may leak files
> ------------------------------------------------
>
>                 Key: ARTEMIS-1754
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1754
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 2.5.0
>            Reporter: Howard Gao
>            Assignee: Howard Gao
>            Priority: Major
>             Fix For: 2.5.1
>
>
> This overridden method calls getPersistentSize() which may lead to open the large file
to get the size. Calling it alone will cause the file being opened without closing it.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message