# Intermittent BJ errors

**URL:** <https://www.ruby-forum.com/t/intermittent-bj-errors/134238>\
**Category:** Rails\
**Created:** [April 9, 2008, 7:33am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238 "2008-04-09T07:33:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [April 9, 2008, 7:33am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/1 "2008-04-09T07:33:00Z")

</div>

hi all

I’m running background tasks using BJ 1.0.1 (gem version). On some  
requests, the tasks are executed as expected. On others, I get the  
following error:

RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):

when it runs, it runs fine but does anyone know what could be causing  
these errors?  
I’m using ubuntu 7.10/nginix/mongrel/swiftiply

thanks  
nic

full error message:

RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/util.rb:93:in  
`find_script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/bj.rb:12 /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb: 43:in`instance\_eval’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb:  
43:in `call' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb: 43:in`attribute’  
(eval):3:in `call' (eval):3:in`script!’  
(eval):4:in `script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:120:in`command’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:107:in  
`start' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:62:in`tickle’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/api.rb:66:in  
`submit' /app/controllers/uploads_controller.rb:7:in`create’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/base.rb:1158:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1158:in`perform\_action\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/filters.rb:697:in `call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:689:in`perform\_action\_without\_benchmark’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in`measure’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/benchmarking.rb:68:in  
`perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/rescue.rb:199:in`perform\_action\_without\_caching’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/caching.rb:678:in `perform_action' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:33:in`cache’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
active\_record/query\_cache.rb:8:in `cache' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:677:in`perform\_action’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/base.rb:524:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:in`process\_without\_filters’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/filters.rb:685:in  
`process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session_management.rb:123:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/base.rb:388:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:171:in`handle\_request’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/dispatcher.rb:115:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:126:in`dispatch\_cgi’  
/usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
action\_controller/dispatcher.rb:9:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ rails.rb:76:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
rails.rb:74:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ rails.rb:74:in`process’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
159:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 158:in`each’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
158:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
285:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in`new’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
285:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 268:in`initialize’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
268:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 268:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
configurator.rb:282:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ configurator.rb:281:in`each’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
configurator.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/ mongrel_rails:136:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
command.rb:212:in `run' /usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/ mongrel_rails:252 /usr/local/bin/mongrel_rails:19:in`load’  
/usr/local/bin/mongrel\_rails:19

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [July 15, 2008, 12:41pm UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/2 "2008-07-15T12:41:15Z")

</div>

I’m experiencing similar problems on Ubuntu 8.04

it sucks big time… has anyone found the cause of this?

“no bj found in [”/var/www/oc/releases/20080713133248/script",  
“/sbin”, “/bin”, “/usr/sbin”, “/usr/bin”]"

/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/util.rb:93:in  
`find_script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/bj.rb:12 /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb:43:in`instance\_eval’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb:43:in  
`call' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb:43:in`attribute’  
(eval):3:in `call' (eval):3:in`script!’  
(eval):4:in `script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:120:in`command’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:107:in  
`start' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:62:in`tickle’  
/usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/api.rb:66:in `submit' [RAILS_ROOT]/app/models/user_observer.rb:4:in`after\_create’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active\_record/observer.rb:171:in  
`send' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/observer.rb:171:in`update’  
/usr/local/lib/ruby/1.8/observer.rb:185:in `notify_observers' /usr/local/lib/ruby/1.8/observer.rb:184:in`each’  
/usr/local/lib/ruby/1.8/observer.rb:184:in `notify_observers' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:309:in`notify’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active\_record/callbacks.rb:296:in  
`callback' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/callbacks.rb:221:in`create\_without\_timestamps’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active\_record/timestamp.rb:29:in  
`create' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2472:in`create\_or\_update\_without\_callbacks’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active\_record/callbacks.rb:207:in  
`create_or_update' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/base.rb:2200:in`save\_without\_validation’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active\_record/validations.rb:901:in  
`save\_without\_dirty’

Nic Deakins wrote:

> hi all
> 
> I’m running background tasks using BJ 1.0.1 (gem version). On some  
> requests, the tasks are executed as expected. On others, I get the  
> following error:
> 
> RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):
> 
> when it runs, it runs fine but does anyone know what could be causing  
> these errors?  
> I’m using ubuntu 7.10/nginix/mongrel/swiftiply
> 
> thanks  
> nic
> 
> full error message:
> 
> RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):  
> /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/util.rb:93:in  
> `find_script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/bj.rb:12 /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb: 43:in`instance\_eval’  
> /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb:  
> 43:in `call' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/attributes.rb: 43:in`attribute’  
> (eval):3:in `call' (eval):3:in`script!’  
> (eval):4:in `script' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:120:in`command’  
> /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:107:in  
> `start' /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/runner.rb:62:in`tickle’  
> /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/api.rb:66:in  
> `submit' /app/controllers/uploads_controller.rb:7:in`create’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/base.rb:1158:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:1158:in`perform\_action\_without\_filters’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/filters.rb:697:in `call_filters' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/filters.rb:689:in`perform\_action\_without\_benchmark’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/benchmarking.rb:68:in  
> `perform_action_without_rescue' /usr/local/lib/ruby/1.8/benchmark.rb:293:in`measure’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/benchmarking.rb:68:in  
> `perform_action_without_rescue' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/rescue.rb:199:in`perform\_action\_without\_caching’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/caching.rb:678:in `perform_action' /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record/connection_adapters/abstract/query_cache.rb:33:in`cache’  
> /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/  
> active\_record/query\_cache.rb:8:in `cache' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/caching.rb:677:in`perform\_action’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/base.rb:524:in `send' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/base.rb:524:in`process\_without\_filters’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/filters.rb:685:in  
> `process_without_session_management_support' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/session_management.rb:123:in`process’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/base.rb:388:in `process' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:171:in`handle\_request’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/dispatcher.rb:115:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/ action_controller/dispatcher.rb:126:in`dispatch\_cgi’  
> /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/  
> action\_controller/dispatcher.rb:9:in `dispatch' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ rails.rb:76:in`process’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
> rails.rb:74:in `synchronize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ rails.rb:74:in`process’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
> 159:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 158:in`each’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
> 158:in `process_client' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in`run’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
> 285:in `initialize' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 285:in`new’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
> 285:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 268:in`initialize’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb:  
> 268:in `new' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel.rb: 268:in`run’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
> configurator.rb:282:in `run' /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/ configurator.rb:281:in`each’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
> configurator.rb:281:in `run' /usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/ mongrel_rails:136:in`run’  
> /usr/local/lib/ruby/gems/1.8/gems/mongrel-1.1.4/lib/mongrel/  
> command.rb:212:in `run' /usr/local/lib/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/ mongrel_rails:252 /usr/local/bin/mongrel_rails:19:in`load’  
> /usr/local/bin/mongrel\_rails:19

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [July 15, 2008, 4:58pm UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/3 "2008-07-15T16:58:45Z")

</div>

Nic Deakins wrote:

> hi all
> 
> I’m running background tasks using BJ 1.0.1 (gem version). On some  
> requests, the tasks are executed as expected. On others, I get the  
> following error:
> 
> RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):
> 
> when it runs, it runs fine but does anyone know what could be causing  
> these errors?  
> I’m using ubuntu 7.10/nginix/mongrel/swiftiply
> 
> thanks  
> nic
> 
> full error message:
> 
> RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):  
> /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/util.rb:93:in  
> `find\_script’

bj is telling you what the problem is, if you look at those lines of  
util you’ll see

```
  def find_script basename
    path = ENV["PATH"] || ENV["path"] || Bj.default_path
    raise "no env PATH" unless path
    path = path.split File::PATH_SEPARATOR
    path.unshift File.join(Bj.rails_root, "script")
    path.each do |directory|
      script = File.join directory, basename
      return File.expand_path(script) if(test(?s, script) and 

```

test(?r, script))  
end  
raise “no #{ basename } found in #{ path.inspect }”  
end

and your path is list in the error message. so, the question is

1. _is_ bj on one of those paths above?
2. if it is, is it readable by the user running the rails app?

i suspect this is an installation or path/environment issue, however,  
even if it is, you can always just set the path to bj manually in you  
configuration

Bj.script = ‘/full/path/to/bin/bj’

and even set your path

Bj.default\_path = %w[/usr/bin /usr/local/bin]

so it should be very simple to rememdy

have a look at lib/bj/api.rb and lib/bj/bj.rb

from the look of your error message i’d guess the cap deploy has a  
different environment that another you may be running rails as.

cheers.

-a

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [August 19, 2008, 6:13am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/4 "2008-08-19T06:13:10Z")

</div>

D. Krmpotic wrote:

> Sorry for late reply, but the problem is rather curious…! The catch is  
> in the word ‘intermittent’… we had a lot of these errors in the last 2  
> weeks (when I was away ☹ ) and users couldn’t signup up!
> 
> I ‘solved’ the problem, by restarting THIN servers !?
> 
> Could you suggest a possible explanation? So it is not (an obvious) path  
> problem it seems… because now it works… until it stops again…
> 
> Thank you!  
> david

it seems perfectly obvious to me - you are starting your servers under  
two environments: one has bj in the and one does not. a likely scenario  
is starting from init scripts (machine boot)and from the console. in  
both cases you have to make sure you path is setup correctly.

-a

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [August 21, 2008, 11:31am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/5 "2008-08-21T11:31:21Z")

</div>

Ara, thank you for the answer… but I don’t quite get it… are you  
saying that two Thins are somehow running in different environments? I  
have to say that I don’t see how this could be happening, because it’s a  
Thin cluster and thus all/both instances stem from the same  
configuration. Please elaborate your thinking a little bit. Thanx again

Ara Howard wrote:

> D. Krmpotic wrote:
> 
> > Sorry for late reply, but the problem is rather curious…! The catch is  
> > in the word ‘intermittent’… we had a lot of these errors in the last 2  
> > weeks (when I was away ☹ ) and users couldn’t signup up!
> > 
> > I ‘solved’ the problem, by restarting THIN servers !?
> > 
> > Could you suggest a possible explanation? So it is not (an obvious) path  
> > problem it seems… because now it works… until it stops again…
> > 
> > Thank you!  
> > david
> 
> it seems perfectly obvious to me - you are starting your servers under  
> two environments: one has bj in the and one does not. a likely scenario  
> is starting from init scripts (machine boot)and from the console. in  
> both cases you have to make sure you path is setup correctly.
> 
> -a

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [August 21, 2008, 4:57pm UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/6 "2008-08-21T16:57:25Z")

</div>

D. Krmpotic wrote:

> Ara, thank you for the answer… but I don’t quite get it… are you  
> saying that two Thins are somehow running in different environments? I  
> have to say that I don’t see how this could be happening, because it’s a  
> Thin cluster and thus all/both instances stem from the same  
> configuration. Please elaborate your thinking a little bit. Thanx again

i’m not saying the two are running under different environments, i’m  
saying that when you re-started them by hand, perhaps at the console,  
you may have had a different environment than they were originally  
started under - for instance cron or init.d on system boot. may not be  
the case - but worth inventigating.

-a

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [August 19, 2008, 2:54am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/7 "2008-08-19T02:54:32Z")

</div>

Sorry for late reply, but the problem is rather curious…! The catch is  
in the word ‘intermittent’… we had a lot of these errors in the last 2  
weeks (when I was away ☹ ) and users couldn’t signup up!

I ‘solved’ the problem, by restarting THIN servers !?

Could you suggest a possible explanation? So it is not (an obvious) path  
problem it seems… because now it works… until it stops again…

Thank you!  
david

Ara Howard wrote:

> Nic Deakins wrote:
> 
> > hi all
> > 
> > I’m running background tasks using BJ 1.0.1 (gem version). On some  
> > requests, the tasks are executed as expected. On others, I get the  
> > following error:
> > 
> > RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> > script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):
> > 
> > when it runs, it runs fine but does anyone know what could be causing  
> > these errors?  
> > I’m using ubuntu 7.10/nginix/mongrel/swiftiply
> > 
> > thanks  
> > nic
> > 
> > full error message:
> > 
> > RuntimeError (no bj found in ["/u/apps/igniter/releases/20080408205801/  
> > script", “/bin”, “/usr/bin”, “/sbin”, “/usr/sbin”]):  
> > /usr/local/lib/ruby/gems/1.8/gems/bj-1.0.1/lib/bj/util.rb:93:in  
> > `find\_script’
> 
> bj is telling you what the problem is, if you look at those lines of  
> util you’ll see
> 
> ```
> def find_script basename
> path = ENV["PATH"] || ENV["path"] || Bj.default_path
> raise "no env PATH" unless path
> path = path.split File::PATH_SEPARATOR
> path.unshift File.join(Bj.rails_root, "script")
> path.each do |directory|
> script = File.join directory, basename
> return File.expand_path(script) if(test(?s, script) and 
> 
> ```
> 
> test(?r, script))  
> end  
> raise “no #{ basename } found in #{ path.inspect }”  
> end
> 
> and your path is list in the error message. so, the question is
> 
> 1. _is_ bj on one of those paths above?
> 2. if it is, is it readable by the user running the rails app?
> 
> i suspect this is an installation or path/environment issue, however,  
> even if it is, you can always just set the path to bj manually in you  
> configuration
> 
> Bj.script = ‘/full/path/to/bin/bj’
> 
> and even set your path
> 
> Bj.default\_path = %w[/usr/bin /usr/local/bin]
> 
> so it should be very simple to rememdy
> 
> have a look at lib/bj/api.rb and lib/bj/bj.rb
> 
> from the look of your error message i’d guess the cap deploy has a  
> different environment that another you may be running rails as.
> 
> cheers.
> 
> -a

---

<div class="post-metadata">

**Author:** ![Nic\_Deakins](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/b38774/32.png) [@Nic\_Deakins](https://www.ruby-forum.com/u/Nic_Deakins)\
**Post date:** [September 23, 2008, 11:16am UTC](https://www.ruby-forum.com/t/intermittent-bj-errors/134238/8 "2008-09-23T11:16:19Z")

</div>

Sorry for late response… You were right…  
After adding

export PATH=/usr/local/bin:$PATH

on top of /etc/init.d/thin script, BJ works fine after server restart.

Thank you.  
david

Ara Howard wrote:

> D. Krmpotic wrote:
> 
> > Ara, thank you for the answer… but I don’t quite get it… are you  
> > saying that two Thins are somehow running in different environments? I  
> > have to say that I don’t see how this could be happening, because it’s a  
> > Thin cluster and thus all/both instances stem from the same  
> > configuration. Please elaborate your thinking a little bit. Thanx again
> 
> i’m not saying the two are running under different environments, i’m  
> saying that when you re-started them by hand, perhaps at the console,  
> you may have had a different environment than they were originally  
> started under - for instance cron or init.d on system boot. may not be  
> the case - but worth inventigating.
> 
> -a
