# BackgroundRB - not listening to mongrel/nginx

**URL:** <https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955>\
**Category:** Rails\
**Created:** [November 10, 2008, 12:58pm UTC](https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955 "2008-11-10T12:58:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 10, 2008, 12:58pm UTC](https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955/1 "2008-11-10T12:58:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 10, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955/2 "2008-11-10T16:44:27Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 10, 2008, 9:00pm UTC](https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955/3 "2008-11-10T21:00:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [November 11, 2008, 10:13am UTC](https://www.ruby-forum.com/t/backgroundrb-not-listening-to-mongrel-nginx/152955/4 "2008-11-11T10:13:01Z")

</div>

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 😕
