Issue Type: Bug Bug
Affects Versions: JRuby 1.6.8
Assignee: Unassigned
Attachments: JRubyTest.java
Components: Embedding
Created: 01/Nov/12 6:10 AM
Description:

Currently we have a big problem with JRuby-integration in our software.

We're using JRuby to customize our application, do some calulations and some user defined jobs.

Therefore we've embedded JRuby like in the short attached example.
Currently we're using the default configuration with
LOCALCONTEXT_SCOPE = SINGLETON
LOCALVARIABLE_BEHAVIOR = GLOBAL

because we pass some arguments and utils to the scripts (used as global variables inside the scripts).

Now we have the problem, that with this configurations the global variables will be shared over all evaluations.
--> This means that we have variables in our context:

  • are unrelated to the current execution
  • somtimes have an instance from another evaluation
  • somtimes become nil during evaluation

Thefore I tried to change the settings to
LOCALCONTEXT_SCOPE = THREADSAFE
LOCALVARIABLE_BEHAVIOR = GLOBAL

These settings avoid the problems mentioned above but:

  • the evaluations are very slow
  • the avaluations will end very fast in an OutOfMemoryError

I've attached my test-class to test the different settings.

The output shows the instance of the global variable "$list" per execution, set a global variable "$test = $list.size" and does a second evaluation to check if "$test" is nil or not.

The needed behavior ist the each evaluation has it's own instance of "$list" and "$test" should be nil in the second evaluation.

Is there a way to configure the ScriptEngine to ensure the needed behavior without the OutOfMemoryError?
--> We really need the global variables becuase:

  • our customers have a lot of scripts using them
  • we are passing different arguments to the script and want to use them in "inner" classes and methods without passing them through.
Environment: Windows XP 32bit, Java 1.6.0_25 or 1.7.0_05
Project: JRuby
Labels: jruby outofmemory global localcontext_scope localvariable_behavior variables nil
Priority: Blocker Blocker
Reporter: Markus Koch
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
--------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Reply via email to