You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by "Dave Stanley (JIRA)" <ji...@apache.org> on 2009/07/23 20:28:33 UTC

[jira] Created: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

CachedOutputStream not cleaning up tmp files when using file based caching
--------------------------------------------------------------------------

                 Key: CAMEL-1849
                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
             Project: Apache Camel
          Issue Type: Bug
          Components: camel-core, camel-http
    Affects Versions: 1.6.1
         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
            Reporter: Dave Stanley
             Fix For: 1.6.2
         Attachments: camel_1.x_patch.txt

A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52931#action_52931 ] 

Willem Jiang commented on CAMEL-1849:
-------------------------------------

Here is a thing, if you close the input stream of the HttpProducer, you will not get a readable InputStream from the message body of the exchange which will be processed after the HttpProducer.

Please remember to call the close of the InputStream , If you want to make sure the temp file to be deleted.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52936#action_52936 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

Yes it should be patched in 2.0 as well.

I wonder if the closing the input stream should be in a finally block to ensure its always closed?

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52966#action_52966 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

1.x: 797920.

You can now disable disk based cache by setting a threshold of 0 or negative

Updated wiki as well:
http://cwiki.apache.org/confluence/display/CAMEL/Stream+caching

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Work started: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Work on CAMEL-1849 started by Hadrian Zbarcea.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52929#action_52929 ] 

Hadrian Zbarcea commented on CAMEL-1849:
----------------------------------------

@Dave, awesome!

Is this fix required in 2.0 as well?

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-1849:
----------------------------------

    Assignee: Claus Ibsen  (was: Hadrian Zbarcea)

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Dave Stanley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52970#action_52970 ] 

Dave Stanley commented on CAMEL-1849:
-------------------------------------

Thanks Claus! Really like the exchange.addOnCompletion(). Didn't know you could do that.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52963#action_52963 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

1.x: 797911.

unit test demonstrating the issue to help resolve the issue on 1.x branch

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Dave Stanley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52949#action_52949 ] 

Dave Stanley commented on CAMEL-1849:
-------------------------------------

@Willem,

If the stream is not closed in HttpProducer, wondering where is the right place to close the stream? I definitely think it should be automatically cleaned up. 

(I would be happy to try and tweak the patch if you can provide some suggestion on how it can be improved upon)


> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Willem Jiang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52947#action_52947 ] 

Willem Jiang commented on CAMEL-1849:
-------------------------------------

@Claus,

But we don't know if there is another processor or endpoint after the HttpProducer, so we can't close the InputStream in the HttpProducer.



> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Dave Stanley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52958#action_52958 ] 

Dave Stanley commented on CAMEL-1849:
-------------------------------------

Given this stream is only created to hold the body of of http exception's, another option might be to change the HttpOperationFailedException implementation to use a string for the body rather than an InputStream. 

This way the stream can be safely closed in HttpProducer. 

In terms of the exception body itself, if its a large exception body the entire body could be logged and then [optionally] truncated in the Exception object itself if needed?
 



> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52960#action_52960 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

*Some observations*

1. 
CachedOutputStream is build as if its holds multiple streams (i.e. it has a streamList) but its only used in Camel as wrapping a single stream.

2.
It got an output locked option that is newer used, i.e. could be removed to reduce complexity

3.
it lacks try .. finally to ensure proper house cleaning when working with streams

4.
It silently ignore the output dir if provided with one and it cannot create the directory.
It should really throw an exception to indicate the temp output folder cannot be used

5. Some methods is newer used and should be removed to reduce complexity
- resetOut
- lockOutputStream
- getBytes
- writeCacheTo (can be removed as its only used for toString that should just omit printing the stream content)
- getOut
- getTempFile
- getInputStream

6. Duplicate code
The write methods has duplicate code that should be avoided and instead invoke a single method that does the actual writing

7. Using java.io.File instead of NIO
The NIO library have features to support paging memory to disk. But yeah its a bit complex to work with the NIO but it is faster and it can leverage the OS memory paging to be faster. 



> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Jonathan Anstey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52930#action_52930 ] 

Jonathan Anstey commented on CAMEL-1849:
----------------------------------------

Yeah, thanks Dave!

Hadrian, don't forget to add in a check for null in HttpProducer as well ala

{code}
+                if (is != null) { 
+                    is.close();
+                }
{code}

HttpProducerSelectMethodTest fails without this mod.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52962#action_52962 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

trunk: 797907.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52965#action_52965 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

1.x: 797918.

A fix so the tmp files is also deleted in case of an http exception. And the http exception uses a copy of the stream so its detached.

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Dave Stanley (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dave Stanley updated CAMEL-1849:
--------------------------------

    Attachment: camel_1.x_patch.txt

Patch and testcase attached. 

Two changes were required, on in HttpProducer.java and the other in CachedOutputStream itself. 

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52959#action_52959 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

Dave, yeah a good idea to store the content as a String instead to detach it from the underlying stream.

As it only occurs when an exception is to be thrown then the overhead is negligible.

Maybe the stream should be closed as part of the exchange unit of work terminating?
We do that for instance with other components where they do house cleaning.

And removing temporary work files would make sense to do in this part as well. And I do believe the code could use an overhaul as well since its a bit _tricky_ in places.
For instance generating the temporary filename should just use the exchange id as its unique and a much better name than a generated number. 

I would take a 2nd look and ping back ideas

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen resolved CAMEL-1849.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

trunk: 797923.

To disable the file based cache

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2, 2.0.0
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Hadrian Zbarcea (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hadrian Zbarcea reassigned CAMEL-1849:
--------------------------------------

    Assignee: Hadrian Zbarcea

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52964#action_52964 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

Setting the threshold to -1 or 0 should disable file based cache all together

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Claus Ibsen
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CAMEL-1849) CachedOutputStream not cleaning up tmp files when using file based caching

Posted by "Claus Ibsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/CAMEL-1849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=52961#action_52961 ] 

Claus Ibsen commented on CAMEL-1849:
------------------------------------

I am working on patching this for Camel 2.0 and cleaning up the code in CachedOutputStream

> CachedOutputStream not cleaning up tmp files when using file based caching
> --------------------------------------------------------------------------
>
>                 Key: CAMEL-1849
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1849
>             Project: Apache Camel
>          Issue Type: Bug
>          Components: camel-core, camel-http
>    Affects Versions: 1.6.1
>         Environment: Camel 1.x branch. 2.0 branch also appears to have the same problem
>            Reporter: Dave Stanley
>            Assignee: Hadrian Zbarcea
>             Fix For: 1.6.2
>
>         Attachments: camel_1.x_patch.txt
>
>
> A recent feature of Camel's CachedOutputStream is to serialize any messages over 64k to disk. In some cases the *tmp message files are not being cleaned up. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.