BackgroundRB - not listening to mongrel/nginx


#1

I’m trying to get backgroundrb set up and working but i have a problem
getting it to listen to our server. It works for me locally, with these
settings -


:backgroundrb:
:ip: 0.0.0.0
:port: 11006
:environment: development
:persistent_delay: 10

The problem is trying to get it working on our server. I’m trying it on
our ‘staging’ environment, with these settings:


:backgroundrb:
:ip: 0.0.0.0
:port: 11006
:environment: staging
:persistent_delay: 10

I start it with
sudo ./script/backgroundrb start -e staging

and it is running - i can see, in the log file, the bdrb_job_queues
table being checked every 10 seconds. But, when i try to make a call to
it from the app, the background worker is called from my code but
nothing happens: it looks like backgroundrb just doesn’t hear the
request.

I suspect it might be to do with the ip and/or port setting - i tried
changing the ip to 127.0.0.1 but that didn’t help. We use an nginx
server with a mongrel cluster beneath, and my knowledge of how they
communicate re ip addresses and ports is pretty much nonexistent. Can
anyone help?

thanks
max


#2

I fixed this, it was a dumb error on my part to do with how i was
testing it. In the process i worked out how to write to a custom log
file from backgroundrb (this showed me what i was doing wrong).


#3

Great work Max. Do you want to share with us what you did to create a
custom log and actual troubleshooting process?
Thanks.
Bharat


#4

Bharat R. wrote:

Great work Max. Do you want to share with us what you did to create a
custom log and actual troubleshooting process?
Thanks.
Bharat

Yeah - in the worker class:

class LmailWorker < BackgrounDRb::MetaWorker
set_worker_name :lmail_worker
@@logger = Logger.new(“log/backgroundrb_custom.log”)

def ldb(debug_text)
@@logger.info “### #{caller[0]}: #{debug_text}”
end

def create(args = nil)
# this method is called, when worker is loaded for the first time
ldb “created LmailWorker”
end
end

Example logger output -

/var/www/apps/e_learning_staging/releases/20081110183756/lib/workers/lmail_worker.rb:11:in
`create’: created LmailWorker

This only gets me some of the way actually. I have two workers - one of
them responds, the other doesn’t, and i don’t get any useful information
from the one that doesn’t respond. I can;t think of a way to diagnose
the problem :confused: