Closed ianschreuder closed 8 years ago
The stack limit checking does not work with multi-threading. RJava and RPython disable stack checking with: R_CStackLimit = (uintptr_t) -1;
Where and how to set R_CStackLimit? Is it possible to do it to get RSRuby working it threads? For me its quite serious issue. If I run it in two system processes, it's ok... Do you think it's better way how to run it parallel?
I just checked in a fix disabling stack limit. You can check it out on my branch. However beware that R is not inherently multithreaded, so you may run into other issues.
Thank you. It wasn't so big patch as I see. Btw. running RSRuby with processes made with Parallel gem haven't causes any problem yet. So this can be another way...
I'm running into the same issue, but aaronjgs patch fixes this. When will this be integrated into alexgutteridges version of rsruby?
This took me a while to find. Turns out that when you're calling a method, via the rails runner capability...the issue disappears. It's only from within the WEBrick this occurs.
I am also having the same problems. If aaronjg changes could be pushed into the main repo that would be greatly appreciated.
thanks @aaronjg +1
Fix works, thanks! +1 for pulling that into the main repo.
Rsruby is not thread safe.
code:
require 'rsruby'
Thread.new { rsruby = RSRuby.instance rsruby.rnorm(100) }.join
results in:
Error: C stack usage is too close to the limit Error: C stack usage is too close to the limit NoMethodError: R Function "get" not found
``from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/gems/1.9.1/gems/rsruby-0.5.1.1/lib/rsruby.rb:97:in
get_fun' from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/gems/1.9.1/gems/rsruby-0.5.1.1/lib/rsruby.rb:97:inreset_cache' from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/gems/1.9.1/gems/rsruby-0.5.1.1/lib/rsruby.rb:85:in
initialize' from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/1.9.1/singleton.rb:109:innew' from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/1.9.1/singleton.rb:109:in
block in instance' from internal:prelude:10:insynchronize' from /usr/local/ruby-1.9.2-p180.aba/lib/ruby/1.9.1/singleton.rb:107:in
instance' from (irb):3:in `block in irb_binding'