-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rjb hangs in Ruby 2.0 within background jobs #24
Comments
I have no knowledge about both Sidekiq and Resque, so I wonder if you let me know the technical details of 'background job'. Is it a forked and executed process ? If so, the hangup means 1) the parent process can't recognize the termination of the child process or 2) the child process runs eternally ? And it's very important that what function Sidekiq or Resque use to spawn the job. Kenrl.fork, system or spawn ? Because Ruby was restructed these functions between 1.9 and 2.0. |
Resque forks: Sidekiq uses celluloid (threads): https://github.com/celluloid/celluloid/blob/ebd0c300ea76b43c1881c1036f918133b6bf7b6a/lib/celluloid/internal_pool.rb#L97 It's almost like the child process runs until rescue/sidekiq kill the job. Through logging in 1.9.3 we had some logging before and after the call (which worked correctly). In 2.0 it did the logging before the call, and then the call just hung. I can't seem to dig up a good resource on the changes between 1.9 and 2.0 Kernel/Thread, do you have one that I could take a look at? I'd like to contribute backwards compatibility between 1.9 and 2.0. We had to write a quick rake task to deal with our Rjb job, and I'd really like to move that into a proper background job processing system. |
Umm, it's difficult because I see that Resque and Sidekiq use completely separate issues. |
No logs ? |
I have a bit more information about this (ran into the same thing) My environment: rails 4, ruby 2.1.1p76, class SimpleJob
include Resque::Plugins::Status
@queue = :fetch_scheduler
$DEBUG=true #is this how you set it? I don't know...
$VERBOSE = true
require 'rjb'
Point = Rjb::import('java.awt.Point')
def perform
p = Point.new(0, 0)
p.y = 80
puts "x=#{p.x}, y=#{p.y}" # => "0,80"
end
end the above works fine. However, calling my intended java library, it goes into a black hole and does not return. If you can be more specific in how to turn on the verbose msg options, I can try those. I can confirm it also runs fine in an inline process. |
It seems PATH or version conflicting issue. |
Same issue, Under resque worker,
ruby version: Strip resque:
In 2.0.0, it fails without any error, in 1.9.3, it tells me:
|
Hi do you use rvm, rbenv type of ruby environment changer ? |
According to above code, it works when call |
Loading gem only requires ruby's loading mechanism, not depending on the compilation time linking. |
I will try to work this out.. |
Hi, I've managed to create a demo for this bug: https://github.com/halida/rjb_bug clone it, bundle install, then make, it will run a function |
Hi I am busy and have no responsibility for spending time for such wrong person, but kindly I have tested. java version: 1.7.0_21 |
halida, why do you lock rjb version 1.3.9 ? |
Also I found your run.rb has a bug. |
I've tried making a call through Rjb in both Sidekiq and Resque. When the background job is being processed it gets up to .call and then just hangs.
This only happens in Ruby 2.0 (Ruby 1.9.3 seems to work fine). I've tried with both Rjb 1.4.3 & 1.4.8.
The Rjb code works fine within an inline process (a page request in rails).
Other people seem to be running into a similar problem here: resque/resque#795
The text was updated successfully, but these errors were encountered: