Rails: segmentation error in Rjb when running in the background works fine, if not in the background?

I run the Resque background task and keep getting a segmentation error when I call a gem that uses Rjb. Everything works fine, though, if you run out of place in the background. Here is the line in gem that causes the error:

def self.rjb_initialize return if ::Rjb::loaded? ::Rjb::load(nil, self.jvm_args) #THIS IS WHERE THE ERROR TRACES TO set_java_logging if self.log_file end 

Pearl downloads .jar files, as you can see, but then again, everything works fine when not in the background. What can cause the problem and can it be fixed?

+7
source share
1 answer

Given that the error does not seem to work while running as a background task, this is most likely due to the fact that environment variables are not set. According to docs , the use of rjb in Rails requires LD_LIBRARY_PATH and JAVA_HOME settings. I think you can just add them to environment.rb and ensure that the: resque: setup '=>: environment task is used to load the Rails environment.

0
source

All Articles