# Debian + Apache2 + mod\_fcgid + "Application Error"

**URL:** <https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756>\
**Category:** Rails\
**Created:** [December 8, 2005, 2:09pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756 "2005-12-08T14:09:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 8, 2005, 2:09pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/1 "2005-12-08T14:09:52Z")

</div>

Hello all,

I’m having a weird problem, which I find very hard to debug. The  
production version of my rails app runs on Debian, Apache2 and  
mod\_fcgid. On the development machines I run WEBrick on Debian and  
OSX. I also have test “production” version running on mod\_fastcgi and  
apache 1 on OSX.

On the production machine (Debian) I get application errors which  
don’t appear on any of the other machines. If I switch to running the  
app on WEBrick on the same machine and the same database I don’t see  
any errors, in fact all goes well.

If I run the app (with the same database data) on my development  
machine on WEBrick or on the Apache with mod\_fastcgi, all runs well  
also. No errors whatsoever.

I’ve posted the stripped code and errors on:  
[http://www.larik.nl/DHTML/bugs/Rails/rails\_problem\_mod\_fcgid.html](http://www.larik.nl/DHTML/bugs/Rails/rails_problem_mod_fcgid.html)

If someone knows what’s going on here, please let me know.

–  
Sincerely,

Frodo L.

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 8, 2005, 6:29pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/2 "2005-12-08T18:29:52Z")

</div>

Frodo L. wrote:

> app on WEBrick on the same machine and the same database I don’t see  
> any errors, in fact all goes well.
> 
> If I run the app (with the same database data) on my development  
> machine on WEBrick or on the Apache with mod\_fastcgi, all runs well  
> also. No errors whatsoever.
> 
> I’ve posted the stripped code and errors on:  
> [http://www.larik.nl/DHTML/bugs/Rails/rails\_problem\_mod\_fcgid.html](http://www.larik.nl/DHTML/bugs/Rails/rails_problem_mod_fcgid.html)

I suspect your problem is that ruby/rails is taking too long to start up  
the first time and mod\_fcgid is killing the process because it sees it  
as a timeout. If you look at your apache2 error log (by default  
/var/log/apache2/error.log on Debian) you will see messages from  
mod\_fcgid about shutting down the process.

Check out the directives here:  
[http://fastcgi.coremail.cn/doc.htm](http://fastcgi.coremail.cn/doc.htm)

These are probably the relevant ones for your problem:

IPCConnectTimeout n (2 seconds)  
The connect timeout to a fastcgi application.

IPCCommTimeout n (5 seconds)  
The communication timeout to a fastcgi application.

Try bumping those limits up in your apache2 conf. Using the Debian  
package management system, the conf for mod\_fcgid is located here:  
/etc/apache2/mods-available/fcgid.conf

eg:  
IPCConnectTimeout 10  
IPCCommTimeout 25

You will probably have to experiment with the proper timeout values, as  
the startup time of ruby/rails depends on the hardware you are running  
it on.

-F

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 9, 2005, 10:49am UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/3 "2005-12-09T10:49:03Z")

</div>

On 12/8/05, Finn S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> These are probably the relevant ones for your problem:
> 
> IPCConnectTimeout n (2 seconds)  
> The connect timeout to a fastcgi application.
> 
> IPCCommTimeout n (5 seconds)  
> The communication timeout to a fastcgi application.

I already had them in place, I also bumped them to very high values, but  
it  
didn’t solve the problem.

–  
Sincerely,

Frodo L.

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 9, 2005, 5:01pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/4 "2005-12-09T17:01:39Z")

</div>

Frodo L. wrote:

> it didn’t solve the problem.  
> The fact that this works correctly with mod\_fastcgi and webrick, but not  
> with mod\_fcgid indicates that the problem is somewhere in the fcgid  
> configuration or environment. I think to track this down you are going  
> to have to make the apache2/fcgid logging as verbose as possible and  
> look in those logs rather than in the rails logs. (Although the rails  
> fastcgi.crash.log might be helpful.) You also might see if you can get  
> any other cgis running under mod\_fcgid.

-F

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 11, 2005, 1:25pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/5 "2005-12-11T13:25:39Z")

</div>

Am Freitag, den 09.12.2005, 10:52 -0500 schrieb Finn S.:

> > I already had them in place, I also bumped them to very high values, but  
> > it didn’t solve the problem.
> 
> The fact that this works correctly with mod\_fastcgi and webrick, but not  
> with mod\_fcgid indicates that the problem is somewhere in the fcgid  
> configuration or environment. I think to track this down you are going  
> to have to make the apache2/fcgid logging as verbose as possible and  
> look in those logs rather than in the rails logs. (Although the rails  
> fastcgi.crash.log might be helpful.) You also might see if you can get  
> any other cgis running under mod\_fcgid.

I think it may be a version problem. Try to get the same versions of  
each part of software you are using with your application on both  
Servers, starting at Rails, followed by gems and at least by Ruby  
itself.

I don’t think this is a fcgi problem. But this can be completely wrong.

Does it work if you call dispatch.cgi instead of dispatch.fcgi?

I can say no more to your error, but perhaps you want to follow my  
HowTo:

[http://www.inlet-media.de/the-perfect-ruby-on-rails-with-apache2-and-fastcgi-setup-on-debian-sarge](http://www.inlet-media.de/the-perfect-ruby-on-rails-with-apache2-and-fastcgi-setup-on-debian-sarge)

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 15, 2005, 3:46pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/6 "2005-12-15T15:46:28Z")

</div>

I was struggling with similar problems. Finally it helped me (on Sarge  
AMD64 + Apache2) to delete all session files from /tmp and restart  
apache. On another box (Sid, Apache 1.3) it helped to disable MultiViews  
in Apache cfg and delete all session files as well.

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 15, 2005, 4:39pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/7 "2005-12-15T16:39:21Z")

</div>

On 12/15/05, Jakub C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I was struggling with similar problems. Finally it helped me (on Sarge  
> AMD64 + Apache2) to delete all session files from /tmp and restart  
> apache. On another box (Sid, Apache 1.3) it helped to disable MultiViews  
> in Apache cfg and delete all session files as well.

My sessions use the database for storage and I don’t use multiviews by  
default.

–

> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
> 
> * * *
> 
> Rails mailing list  
> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Sincerely,

Frodo L.

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 15, 2005, 4:45pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/8 "2005-12-15T16:45:22Z")

</div>

On 12/9/05, Finn S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

The fact that this works correctly with mod\_fastcgi and webrick, but not

> with mod\_fcgid indicates that the problem is somewhere in the fcgid  
> configuration or environment. I think to track this down you are going  
> to have to make the apache2/fcgid logging as verbose as possible and  
> look in those logs rather than in the rails logs. (Although the rails  
> fastcgi.crash.log might be helpful.) You also might see if you can get  
> any other cgis running under mod\_fcgid.

I’m also sure now the problem is with fcgid, pages which contain more  
data  
now, have trouble loading, espicially with nested templates.

–  
Sincerely,

Frodo L.

---

<div class="post-metadata">

**Author:** ![frodolarik](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/22d042/32.png) [@frodolarik](https://www.ruby-forum.com/u/frodolarik)\
**Post date:** [December 15, 2005, 4:33pm UTC](https://www.ruby-forum.com/t/debian-apache2-mod-fcgid-application-error/49756/9 "2005-12-15T16:33:19Z")

</div>

On 12/11/05, Norman T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I think it may be a version problem. Try to get the same versions of  
> each part of software you are using with your application on both  
> Servers, starting at Rails, followed by gems and at least by Ruby  
> itself.

On both systems the are the same.

I don’t think this is a fcgi problem. But this can be completely wrong.

> Does it work if you call dispatch.cgi instead of dispatch.fcgi?

Yep.

I can say no more to your error, but perhaps you want to follow my

> HowTo:
> 
> [http://www.inlet-media.de/the-perfect-ruby-on-rails-with-apache2-and-fastcgi-setup-on-debian-sarge](http://www.inlet-media.de/the-perfect-ruby-on-rails-with-apache2-and-fastcgi-setup-on-debian-sarge)

I tried fastcgi before, I didn’t like it because of the processess which  
stay running even after restarting apache.

> removed\_email\_address@domain.invalid  
> [http://lists.rubyonrails.org/mailman/listinfo/rails](http://lists.rubyonrails.org/mailman/listinfo/rails)

–  
Sincerely,

Frodo L.
