To work out if it's your use of the ProducerTemplate, try the following route instead and see whether the leak persists:

from("timer://foo?period=1000")
    .transform().constant("/home/_username_/some_temp_script.sh")
.to("ssh://_remote.machine.url.here_?username=_username_&keyPairProvider=#keyPairProvider")
    .log("Received: ${body}");

On 12/11/15 14:35, codan84 wrote:
I did write a simple app using Spring Boot (1.2.7.RELEASE) and Apache Camel
(2.15.0). The app is simple and has only 1 route: a timer will invoke a
method on a bean every 1s. The method invoked will use ProducerTemplate to
ssh into a remote machine, execute a small script, and print out the output
to the console. Simple, right?
However, when profiling this, I can see the number of threads! It seems like
any threads created for the ssh are never killed, but parked instead.
Because of that I run OOM pretty quickly with an error:

Exception in thread "Thread-341" java.lang.OutOfMemoryError: unable to
create new native thread

More description and profiler results can be found on stackoverflow:
http://stackoverflow.com/questions/33671567/spring-boot-camel-producertemplate-memory-leak

I think this is a bug, as from the documentation I can't see that I am using
the ProducerTemplate wrongly.
Or am I? If so, please tell me. If I am doing things right and it seems like
a bug, I will submit it...



--
View this message in context: 
http://camel.465427.n5.nabble.com/Spring-Boot-Camel-producerTemplate-ssh-spawning-thousands-of-threads-tp5773741.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to