# Suggestions needed for strange problem on only one mongrel i

**URL:** <https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106>\
**Category:** Deployment\
**Created:** [April 4, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106 "2007-04-04T19:25:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [April 4, 2007, 7:25pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/1 "2007-04-04T19:25:43Z")

</div>

I’m about to release my app (was going to today), but have found a last  
minute bug that I’m have difficulty tying down, never mind fix. It’s  
occurring sporadically, and is fixed (temporarily) by restarting the  
instance of the mongrel, but is not always caused by the same page.  
Honestly, I’m not sure I know where to start trying to track it down,  
and any help would be appreciated.

What’s happening is this. If I hit one particular page (have observed  
this on only two pages so far but of course may affect others) with  
photos on it a number of times it renders fine (the photos are linked to  
the model via attachment\_fu, which is using Image Science, not RMagick).

Then suddenly, it blows up, with one of two errors. The first error is  
the following (can post full stack trace if anyone thinks it’s useful):

A ActionView::TemplateError occurred in modtypes#show:

exit  
On line #1 of app/views/shared/\_main\_photo.rhtml

```
1: <% if main_photo.medium_image_url %>
2: <div class="main_photo">
3: <%= link_to image_tag(main_photo.medium_image_url, {:alt => 

```

main\_photo.title, :title =\> main\_photo.caption}), photo\_path(main\_photo)  
%\>  
4:

\<%= link\_to(  
truncate(main\_photo.caption,80, “… see more”), photo\_path(main\_photo))  
if main\_photo.caption %\>

```
/usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:70:in `exit'
/usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:70:in 

```

`rootdir' /usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:84:in`directory’  
/usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:257:in  
`so_name' /usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:291:in`load\_cache’  
/usr/lib/ruby/gems/1.8/gems/RubyInline-3.6.2/inline.rb:627:in  
`inline' /usr/lib/ruby/gems/1.8/gems/image_science-1.1.1/lib/image_science.rb:84 /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:32:in`gem\_original\_require’  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:32:in  
`require' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in`require’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:343:in  
`new_constants_in' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in`require’  
#{RAILS\_ROOT}/vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu/processors/image\_science\_processor.rb:1  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:496:in  
`require' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:343:in`new\_constants\_in’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:496:in  
`require' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:105:in`require\_or\_load’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:249:in  
`load_missing_constant' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:453:in`const\_missing’  
#{RAILS\_ROOT}/vendor/plugins/attachment\_fu/lib/technoweenie/attachment\_fu.rb:82:in  
`const_get' #{RAILS_ROOT}/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:82:in`has\_attachment’  
#{RAILS\_ROOT}/app/models/photo\_image.rb:8  
/usr/local/lib/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_require' /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:496:in  
`require' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:343:in`new\_constants\_in’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:496:in  
`require' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:105:in`require\_or\_load’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:249:in  
`load_missing_constant' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:453:in`const\_missing’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:465:in  
`const_missing' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1355:in`compute\_type’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/reflection.rb:125:in  
`send' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/reflection.rb:125:in`klass’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/reflection.rb:129:in  
`table_name' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb:74:in`construct\_sql’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/associations/has\_one\_association.rb:6:in  
`initialize' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations.rb:882:in`new’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/associations.rb:882:in  
`photo_image' #{RAILS_ROOT}/app/models/photo.rb:45:in`medium\_image\_url’  
#{RAILS\_ROOT}/app/views/shared/\_main\_photo.rhtml:1:in  
`\_run\_rhtml\_47app47views47shared47\_main\_photo46rhtml’

Then if the same instance is hit again it returns a slightly different  
error:

A ActionView::TemplateError occurred in modtypes#show:

Expected  
/home/frankg/sites/carstuff/current/config/…/app/models/photo\_image.rb  
to define PhotoImage  
On line #1 of app/views/shared/\_main\_photo.rhtml

```
1: <% if main_photo.medium_image_url %>
2: <div class="main_photo">
3: <%= link_to image_tag(main_photo.medium_image_url, {:alt => 

```

main\_photo.title, :title =\> main\_photo.caption}), photo\_path(main\_photo)  
%\>  
4:

\<%= link\_to(  
truncate(main\_photo.caption,80, “… see more”), photo\_path(main\_photo))  
if main\_photo.caption %\>

```
#{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:250:in 

```

`load_missing_constant' #{RAILS_ROOT}/vendor/rails/activesupport/lib/active_support/dependencies.rb:453:in`const\_missing’  
#{RAILS\_ROOT}/vendor/rails/activesupport/lib/active\_support/dependencies.rb:465:in  
`const_missing' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/base.rb:1355:in`compute\_type’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/reflection.rb:125:in  
`send' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/reflection.rb:125:in`klass’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/reflection.rb:129:in  
`table_name' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations/has_one_association.rb:74:in`construct\_sql’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/associations/has\_one\_association.rb:6:in  
`initialize' #{RAILS_ROOT}/vendor/rails/activerecord/lib/active_record/associations.rb:882:in`new’  
#{RAILS\_ROOT}/vendor/rails/activerecord/lib/active\_record/associations.rb:882:in  
`photo_image' #{RAILS_ROOT}/app/models/photo.rb:45:in`medium\_image\_url’  
#{RAILS\_ROOT}/app/views/shared/\_main\_photo.rhtml:1:in  
`\_run\_rhtml\_47app47views47shared47\_main\_photo46rhtml’

While all this is going on, the other mongrel instances are serving up  
the page with no probs. I’m running Ruby 1.8.5 with Rails 1.2.1  
(frozen), on a number of Xen instances running Debian etch.

The page above is simply a ‘show’ page. There’s no dynamic resizing of  
photos, or anything like that (so not sure why Image Science is being  
invoked in the first error). It’s a really very straightforward page  
from a controller/view perspective.

If anyone has any ideas, or point me towards a strategy for tracking  
down the problem, I’d be very grateful.  
Many thanks  
Chris

---

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [April 20, 2007, 3:30pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/2 "2007-04-20T15:30:36Z")

</div>

Hi Chris,

I have exactly the same problem here, with the following config: Debian  
Sarge, ruby 1.8.4, Rails 1.2.3 (with some patches backported from  
trunk), attachment\_fu (revision 2834), RubyInline 3.6.2, mongrel 1.0.1.

The two same errors are happening on view-only pages, if an image exists  
or not (model with attachment\_fu).

Have you found a solution?

Thanks,

Philippe

---

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [April 20, 2007, 5:43pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/3 "2007-04-20T17:43:28Z")

</div>

Philippe Jayet wrote:

> Thanks,
> 
> Philippe

It was as Ezra said:

```
  Monit starts your mongrels with a fully clean environemnt. Meaning
none of your normal ENV vars are set. WHat you need to do is put 

```

this  
in the top of your environment.rb

```
ENV['HOME'] = "/home/foobar"

  Then restart monit and all the mongrels. This will fix the 

```

problem.

It’s all working lovely now 🙂  
Hope this helps  
Chris

## –

[http://www.autopendium.co.uk](http://www.autopendium.co.uk)  
Stuff about old cars

---

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [June 2, 2007, 4:42pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/4 "2007-06-02T16:42:52Z")

</div>

Ryan D. wrote:

> Set INLINEDIR instead.

Ryan  
I’m sure you’re right (I’m pretty much a deployment novice), but what’s  
the difference/advantages?  
Cheers  
Chris

## –

[http://www.autopendium.com](http://www.autopendium.com)  
Stuff about old cars

---

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [June 2, 2007, 7:46pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/5 "2007-06-02T19:46:21Z")

</div>

Hi Ryan,

> UM. no. Don’t set HOME. that’s just bad.
> 
> Set INLINEDIR instead.

INLINEDIR sounds good. I’ll try that and report the result.

Thanks, P.

---

<div class="post-metadata">

**Author:** ![cwt137](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/7c8e57/32.png) [@cwt137](https://www.ruby-forum.com/u/cwt137)\
**Post date:** [June 1, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/suggestions-needed-for-strange-problem-on-only-one-mongrel-i/91106/6 "2007-06-01T20:51:08Z")

</div>

Chris T. wrote:

> What you need to do is put  
> this  
> in the top of your environment.rb
> 
> ```
> ENV['HOME'] = "/home/foobar"
> 
> ```

UM. no. Don’t set HOME. that’s just bad.

Set INLINEDIR instead.
