Mathias Meyer
2007-Apr-24 14:44 UTC
[Backgroundrb-devel] Bug in Rails worker creation through scheduler
Hi Folks! A small bug in the Scheduler code caused a small nightmare for me over the last hours. The symptoms were that my scheduled worker (Rails-based) wouldn''t start. Nothing in the log files, no errors on the console, no hints whatsoever about what went wrong. So I filled up the code with logging statements and tracked down the problem to line 48 of server/lib/backgroundrb/scheduler.rb. The following statement in that line is bogus: 47:rescue 48: BackgrounDRb::ServerLogger.log_exception(''scheduler'', e) 49:end Since there''s no e defined in the rescue statement, the above statement fails badly and therefore nothing gets logged anywhere. The fix is to either use this style: 47:rescue 48: BackgrounDRb::ServerLogger.log_exception(''scheduler'', $!) 49:end or this one: 47:rescue Exception => e 48: BackgrounDRb::ServerLogger.log_exception(''scheduler'', e) 49:end This issue seems to hit when something went wrong in the initialization of the worker, in my case, an error in the Rails environment setup. So if you''re finding yourself wondering why your workers aren''t doing anything, you should check that there''s no exception being swallowed. Cheers, Mathias -- // Mathias Meyer // www.paperplanes.de
Seemingly Similar Threads
- 0.2.0 worker/slave creation
- can Timeout::timeout(...) be used in a Worker ?
- scheduling worker methods in rails
- Scheduled workers only run once unless you call self.delete inside the worker
- Scheduling same worker/method at different times with different args