Re: NPE with language:ruby and concurrentConsumers

2014-12-31 Thread Christian Mueller
Hi Christoph!

I raised the JIRA https://issues.apache.org/jira/browse/CAMEL-8201 and start
working on it.
I could successfully check, the issue is in Camel and not in JRuby. Add
yourself as watcher on the JIRA to keep you up to date...

Best,
Christian



--
View this message in context: 
http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703p5761196.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: NPE with language:ruby and concurrentConsumers

2014-12-08 Thread Christoph Spenler
Yes Claus,

thread safety out of the box would be nice.
We spent last week digging into some massive performance regression with
Camel  Ruby and parallel processing:
when processing 200 messages in parallel (5 concurrent consumers)
- memory consumption increased from 30MB (Camel 2.8.0) to 90MB (2.12.0) to
1100MB (!) (2.14.0)
- processing time increased from 2s (2.8.0) to 4s (2.12.0) to 78s (!)
(2.14.0)

I uploaded a maven project with the different version setups:
camel-ruby.zip
http://camel.465427.n5.nabble.com/file/n5760324/camel-ruby.zip  

Any ideas what is causing this performance setback in the higher Camel
versions?


Claus Ibsen-2 wrote
 So ideally camel-ruby should set that JVM system property if not
 already set? so you get the thread safe out of the box?





--
View this message in context: 
http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703p5760324.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: NPE with language:ruby and concurrentConsumers

2014-11-28 Thread Claus Ibsen
So ideally camel-ruby should set that JVM system property if not
already set? so you get the thread safe out of the box?

On Fri, Nov 28, 2014 at 11:04 AM, Christoph Spenler
christoph.spen...@worldline.com wrote:
 I used JRuby 1.7.13 which comes with camel-ruby 2.14.0.
 When I override the version with 1.7.16 it works.

 You have to set the org.jruby.embed.localcontext.scope system property to
 threadsafe, otherwise it is not guaranteed that the different bodies are
 processed by the ruby script. In many cases only one of the bodies sent to
 the language endpoint is processed twice.

 Thanks a lot,
 Christoph




 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703p5759757.html
 Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-
Red Hat, Inc.
Email: cib...@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/


NPE with language:ruby and concurrentConsumers

2014-11-27 Thread Christoph Spenler
Hi,

after moving from Camel 2.8 to 2.14 I am facing a problem with the language
component and ruby scripts. With concurrentConsumer  1, a NPE is thrown by
the RubyInstanceConfig class:
java.lang.NullPointerException
at org.jruby.RubyInstanceConfig.init(RubyInstanceConfig.java:1432)
at
org.jruby.embed.internal.AbstractLocalContextProvider.init(AbstractLocalContextProvider.java:42)
at
org.jruby.embed.internal.SingletonLocalContextProvider.init(SingletonLocalContextProvider.java:88)
at
org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:246)
at 
org.jruby.embed.ScriptingContainer.init(ScriptingContainer.java:226)
at
org.jruby.embed.jsr223.JRubyEngineFactory.getScriptEngine(JRubyEngineFactory.java:170)
at
org.apache.camel.builder.script.ScriptBuilder.init(ScriptBuilder.java:136)
at
org.apache.camel.builder.script.ScriptBuilder.init(ScriptBuilder.java:89)
at
org.apache.camel.builder.script.ScriptLanguage.createExpression(ScriptLanguage.java:40)
at
org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:85)
at
org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
at 
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
at
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
at
org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)
at
org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)
at 
org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

This worked fine with Camel 2.8.
I played with some of the ruby system properties like
System.setProperty(org.jruby.embed.localcontext.scope, threadsafe)
but without success.
I have attached a unit test to demonstrate the problem.
ConcurrentJRubyTest.java
http://camel.465427.n5.nabble.com/file/n5759703/ConcurrentJRubyTest.java  
The test passes with Camel 2.8, but fails with Camel 2.14.

Any ideas how to solve this?

Regards
Christoph






--
View this message in context: 
http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: NPE with language:ruby and concurrentConsumers

2014-11-27 Thread Willem Jiang
Which version of JRuby are you using?
I just ran the test in Camel master (2.15-SNAPSHOT) with JDK8 and JDK7, all 
tests are passed.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 27, 2014 at 8:59:26 PM, Christoph Spenler 
(christoph.spen...@worldline.com) wrote:
 Hi,
  
 after moving from Camel 2.8 to 2.14 I am facing a problem with the language
 component and ruby scripts. With concurrentConsumer  1, a NPE is thrown by
 the RubyInstanceConfig class:
 java.lang.NullPointerException
 at org.jruby.RubyInstanceConfig.(RubyInstanceConfig.java:1432)
 at
 org.jruby.embed.internal.AbstractLocalContextProvider.(AbstractLocalContextProvider.java:42)
   
 at
 org.jruby.embed.internal.SingletonLocalContextProvider.(SingletonLocalContextProvider.java:88)
   
 at
 org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:246)
   
 at org.jruby.embed.ScriptingContainer.(ScriptingContainer.java:226)  
 at
 org.jruby.embed.jsr223.JRubyEngineFactory.getScriptEngine(JRubyEngineFactory.java:170)
   
 at
 org.apache.camel.builder.script.ScriptBuilder.(ScriptBuilder.java:136)  
 at
 org.apache.camel.builder.script.ScriptBuilder.(ScriptBuilder.java:89)  
 at
 org.apache.camel.builder.script.ScriptLanguage.createExpression(ScriptLanguage.java:40)
   
 at
 org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:85)
   
 at
 org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)
   
 at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120)  
 at
 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)
   
 at
 org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)
   
 at
 org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
   
 at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
 at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
 at
 org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)
   
 at
 org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)
   
 at
 org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)  
 at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)  
 at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)
  
 This worked fine with Camel 2.8.
 I played with some of the ruby system properties like
 System.setProperty(org.jruby.embed.localcontext.scope, threadsafe)
 but without success.
 I have attached a unit test to demonstrate the problem.
 ConcurrentJRubyTest.java
  
 The test passes with Camel 2.8, but fails with Camel 2.14.
  
 Any ideas how to solve this?
  
 Regards
 Christoph
  
  
  
  
  
  
 --
 View this message in context: 
 http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703.html
   
 Sent from the Camel - Users mailing list archive at Nabble.com.
  



Re: NPE with language:ruby and concurrentConsumers

2014-11-27 Thread Willem Jiang
It’s look like an issue of JRuby, I reproduced the issue with JRuby 1.7.13, and 
the test was passed with JRuby 1.7.16.

--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.iteye.com (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem



On November 28, 2014 at 11:32:58 AM, Willem Jiang (willem.ji...@gmail.com) 
wrote:
 Which version of JRuby are you using?
 I just ran the test in Camel master (2.15-SNAPSHOT) with JDK8 and JDK7, all 
 tests are passed.  
  
 --
 Willem Jiang
  
 Red Hat, Inc.
 Web: http://www.redhat.com
 Blog: http://willemjiang.blogspot.com (English)
 http://jnn.iteye.com (Chinese)
 Twitter: willemjiang
 Weibo: 姜宁willem
  
  
  
 On November 27, 2014 at 8:59:26 PM, Christoph Spenler 
 (christoph.spen...@worldline.com)  
 wrote:
  Hi,
 
  after moving from Camel 2.8 to 2.14 I am facing a problem with the language
  component and ruby scripts. With concurrentConsumer  1, a NPE is thrown by
  the RubyInstanceConfig class:
  java.lang.NullPointerException
  at org.jruby.RubyInstanceConfig.(RubyInstanceConfig.java:1432)
  at
  org.jruby.embed.internal.AbstractLocalContextProvider.(AbstractLocalContextProvider.java:42)

  at
  org.jruby.embed.internal.SingletonLocalContextProvider.(SingletonLocalContextProvider.java:88)

  at
  org.jruby.embed.ScriptingContainer.getProviderInstance(ScriptingContainer.java:246)

  at org.jruby.embed.ScriptingContainer.(ScriptingContainer.java:226)
  at
  org.jruby.embed.jsr223.JRubyEngineFactory.getScriptEngine(JRubyEngineFactory.java:170)

  at
  org.apache.camel.builder.script.ScriptBuilder.(ScriptBuilder.java:136)  
  at
  org.apache.camel.builder.script.ScriptBuilder.(ScriptBuilder.java:89)
  at
  org.apache.camel.builder.script.ScriptLanguage.createExpression(ScriptLanguage.java:40)

  at
  org.apache.camel.component.language.LanguageProducer.process(LanguageProducer.java:85)

  at
  org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)

  at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:120) 
   
  at
  org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)

  at
  org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:398)

  at
  org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)

  at org.apache.camel.processor.Pipeline.process(Pipeline.java:118)
  at org.apache.camel.processor.Pipeline.process(Pipeline.java:80)
  at
  org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:191)

  at
  org.apache.camel.component.seda.SedaConsumer.sendToConsumers(SedaConsumer.java:291)

  at
  org.apache.camel.component.seda.SedaConsumer.doRun(SedaConsumer.java:200)  
  at org.apache.camel.component.seda.SedaConsumer.run(SedaConsumer.java:147)  
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
 
  This worked fine with Camel 2.8.
  I played with some of the ruby system properties like
  System.setProperty(org.jruby.embed.localcontext.scope, threadsafe)
  but without success.
  I have attached a unit test to demonstrate the problem.
  ConcurrentJRubyTest.java
 
  The test passes with Camel 2.8, but fails with Camel 2.14.
 
  Any ideas how to solve this?
 
  Regards
  Christoph
 
 
 
 
 
 
  --
  View this message in context: 
  http://camel.465427.n5.nabble.com/NPE-with-language-ruby-and-concurrentConsumers-tp5759703.html

  Sent from the Camel - Users mailing list archive at Nabble.com.