You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by davsclaus <ci...@yahoo.dk> on 2011/03/30 11:36:35 UTC

Re: http not cleaning up tmp files when exchange is stopped

Can you try with a later release such as 2.6 or 2.7. The tmp files is deleted
using an oncompletion on the Exchange so it ought to be deleted regardless
if you are using stop or not. But that change may have been done in a later
Camel release than you use. I can't remember.

-----
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
--
View this message in context: http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4271109.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: http not cleaning up tmp files when exchange is stopped

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I have created a ticket to track this
https://issues.apache.org/jira/browse/CAMEL-4098


On Sat, Jun 11, 2011 at 8:58 AM, Claus Ibsen <cl...@gmail.com> wrote:
> On Fri, Jun 10, 2011 at 9:43 PM, Jason Burkhardt <jb...@gmail.com> wrote:
>> I dug into this a little further, here's the underlying behavior of the
>> HttpProducer:
>> The method doExtractResponseBodyAsStream in HttpProducer ends up creating a
>> CachedOutputStream based on the server response.  This ends up creating a
>> cos* temp file in java.io.tmpdir+/camel-tmp.
>> These files are only cleaned up when the application is stopped.
>> As a result if I leave everything running for several days this directory
>> grows very large as I request a few hundred mb a day via a web service.
>> Poking around the code I couldn't see anyway to alter this behavior via a
>> property, does anyone have a better idea other than writing a cronjob to
>> look for /tmp/camel-tmp-* every day and nuking it?
>>
>
> Can you create a JIRA ticket for this bug?
>
>
>> On Thu, Jun 9, 2011 at 1:26 PM, Jason Burkhardt <jb...@gmail.com>wrote:
>>
>>> Hate to dredge up an old thread but I'm seeing this same behavior in 2.6.
>>> Note:  I am not calling stop or anything.  This route processes a message
>>> from JMS, calls http, processes the result and publishes it to JMS again.
>>> This ends up writing tmp files with the soap response  to
>>> /tmp/camel-tmp-whatever as long as it is running with no apparent cleanup.
>>> After running for a couple days this was over 1gb.
>>>
>>> Gordon, did you ever find any useful solution?
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4473542.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>>
>
>
>
> --
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus, fusenews
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: http not cleaning up tmp files when exchange is stopped

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Jun 10, 2011 at 9:43 PM, Jason Burkhardt <jb...@gmail.com> wrote:
> I dug into this a little further, here's the underlying behavior of the
> HttpProducer:
> The method doExtractResponseBodyAsStream in HttpProducer ends up creating a
> CachedOutputStream based on the server response.  This ends up creating a
> cos* temp file in java.io.tmpdir+/camel-tmp.
> These files are only cleaned up when the application is stopped.
> As a result if I leave everything running for several days this directory
> grows very large as I request a few hundred mb a day via a web service.
> Poking around the code I couldn't see anyway to alter this behavior via a
> property, does anyone have a better idea other than writing a cronjob to
> look for /tmp/camel-tmp-* every day and nuking it?
>

Can you create a JIRA ticket for this bug?


> On Thu, Jun 9, 2011 at 1:26 PM, Jason Burkhardt <jb...@gmail.com>wrote:
>
>> Hate to dredge up an old thread but I'm seeing this same behavior in 2.6.
>> Note:  I am not calling stop or anything.  This route processes a message
>> from JMS, calls http, processes the result and publishes it to JMS again.
>> This ends up writing tmp files with the soap response  to
>> /tmp/camel-tmp-whatever as long as it is running with no apparent cleanup.
>> After running for a couple days this was over 1gb.
>>
>> Gordon, did you ever find any useful solution?
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4473542.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Re: http not cleaning up tmp files when exchange is stopped

Posted by freesbee EV <en...@gmail.com>.
I have the same issue.
There are some temporary files that aren't deleted.

This an example of my code:

  private class ProcessorSend implements Processor {

  	public void process(Exchange exchange) throws Exception {
  		//... some operations

  		String myEndpoint = "http://localhost:8191/ws/echoService";
                HttpComponent httpComponent = (HttpComponent)
getContext().getComponent("http");
                httpComponent.createEndpoint(myEndpoint);
                Endpoint endpoint = getContext().getEndpoint(myEndpoint);

                try {
         	      Producer producer = endpoint.createProducer();
                      producer.start();
                      // no temporary file in ${java.io.tmpdir}/camel-xxxx/
 		      producer.process(exchange);
 		      // one cos*.tmp file in ${java.io.tmpdir}/camel-xxxx/
                     producer.stop();

                } catch (Exception e) {
         	     //... report exception

               }

              // ... other operation

  	}
  }

I also tried to close the stream from the exchange.getIn() but non change.
The temporary file are deleted only when I stop the application.



--
View this message in context: http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p5758865.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: http not cleaning up tmp files when exchange is stopped

Posted by Willem Jiang <wi...@gmail.com>.
Hi Jason,

I just went though the HttpProducer code, and found if you don't close 
the input stream from the message body, the temp file will never be 
cleaned unless the camel application exits.

The CachedOutputSteam will not be closed when the exchange of the 
HttpProducer oncomplicated, that is because the input stream will be 
used after the exchange is oncomplicated.

Can you double check your code for it?

Willem

On 6/11/11 3:43 AM, Jason Burkhardt wrote:
> I dug into this a little further, here's the underlying behavior of the
> HttpProducer:
> The method doExtractResponseBodyAsStream in HttpProducer ends up creating a
> CachedOutputStream based on the server response.  This ends up creating a
> cos* temp file in java.io.tmpdir+/camel-tmp.
> These files are only cleaned up when the application is stopped.
> As a result if I leave everything running for several days this directory
> grows very large as I request a few hundred mb a day via a web service.
> Poking around the code I couldn't see anyway to alter this behavior via a
> property, does anyone have a better idea other than writing a cronjob to
> look for /tmp/camel-tmp-* every day and nuking it?
>
> On Thu, Jun 9, 2011 at 1:26 PM, Jason Burkhardt<jb...@gmail.com>wrote:
>
>> Hate to dredge up an old thread but I'm seeing this same behavior in 2.6.
>> Note:  I am not calling stop or anything.  This route processes a message
>> from JMS, calls http, processes the result and publishes it to JMS again.
>> This ends up writing tmp files with the soap response  to
>> /tmp/camel-tmp-whatever as long as it is running with no apparent cleanup.
>> After running for a couple days this was over 1gb.
>>
>> Gordon, did you ever find any useful solution?
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4473542.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>


-- 
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog:    http://willemjiang.blogspot.com (English)
          http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang

Re: http not cleaning up tmp files when exchange is stopped

Posted by Jason Burkhardt <jb...@gmail.com>.
I dug into this a little further, here's the underlying behavior of the
HttpProducer:
The method doExtractResponseBodyAsStream in HttpProducer ends up creating a
CachedOutputStream based on the server response.  This ends up creating a
cos* temp file in java.io.tmpdir+/camel-tmp.
These files are only cleaned up when the application is stopped.
As a result if I leave everything running for several days this directory
grows very large as I request a few hundred mb a day via a web service.
Poking around the code I couldn't see anyway to alter this behavior via a
property, does anyone have a better idea other than writing a cronjob to
look for /tmp/camel-tmp-* every day and nuking it?

On Thu, Jun 9, 2011 at 1:26 PM, Jason Burkhardt <jb...@gmail.com>wrote:

> Hate to dredge up an old thread but I'm seeing this same behavior in 2.6.
> Note:  I am not calling stop or anything.  This route processes a message
> from JMS, calls http, processes the result and publishes it to JMS again.
> This ends up writing tmp files with the soap response  to
> /tmp/camel-tmp-whatever as long as it is running with no apparent cleanup.
> After running for a couple days this was over 1gb.
>
> Gordon, did you ever find any useful solution?
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4473542.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

RE: http not cleaning up tmp files when exchange is stopped

Posted by Jason Burkhardt <jb...@gmail.com>.
Hate to dredge up an old thread but I'm seeing this same behavior in 2.6. 
Note:  I am not calling stop or anything.  This route processes a message
from JMS, calls http, processes the result and publishes it to JMS again.
This ends up writing tmp files with the soap response  to
/tmp/camel-tmp-whatever as long as it is running with no apparent cleanup. 
After running for a couple days this was over 1gb.

Gordon, did you ever find any useful solution?

--
View this message in context: http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4473542.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: http not cleaning up tmp files when exchange is stopped

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Try sending plain txt mails (eg turn off HTML mails) that should work
much better with the mailing list.

I cannot reproduce the issue with stop on Camel trunk. I added some
unit tests to camel-jetty to simulate what you are doing and it works
fine.
The tmp files is always deleted.


On Mon, Apr 4, 2011 at 2:58 PM, davsclaus <ci...@yahoo.dk> wrote:
> Thanks. Can you post the route with the stop that fails deleting the tmp
> file?
>
> And if possible feel free to create a JIRA ticket about this issue
> http://camel.apache.org/support
>
> -----
> Claus Ibsen
> -----------------
> FuseSource
> Email: cibsen@fusesource.com
> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.blogspot.com/
> Author of Camel in Action: http://www.manning.com/ibsen/
> --
> View this message in context: http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4281702.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
CamelOne 2011: http://fusesource.com/camelone2011/
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

RE: http not cleaning up tmp files when exchange is stopped

Posted by davsclaus <ci...@yahoo.dk>.
Thanks. Can you post the route with the stop that fails deleting the tmp
file?

And if possible feel free to create a JIRA ticket about this issue
http://camel.apache.org/support

-----
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/
--
View this message in context: http://camel.465427.n5.nabble.com/http-not-cleaning-up-tmp-files-when-exchange-is-stopped-tp4269124p4281702.html
Sent from the Camel - Users mailing list archive at Nabble.com.