Project

General

Profile

FCGI Error when dispatching

Added by Tomasz Jurczyk over 9 years ago

Hi all,

I'm trying to host Redmine using Apache and FastCGI on my CentOS. Through WEBrick everything works perfectly. I followed this tutorial: http://www.redmine.org/projects/redmine/wiki/HowTo_configure_Apache_to_run_Redmine

When I'm trying to run public/dispatch.fcgi, this is what I got:

-bash-4.1$ ./public/dispatch.fcgi
Your FCGI gem does not contain the FCGI shared library, running pure ruby instead
/var/www/html/redmine/vendor/bundle/ruby/1.8/gems/fcgi-0.9.2.1/lib/fcgi.rb:118:in `accept': Socket operation on non-socket (Errno::ENOTSOCK)
    from /var/www/html/redmine/vendor/bundle/ruby/1.8/gems/fcgi-0.9.2.1/lib/fcgi.rb:118:in `session'
    from /var/www/html/redmine/vendor/bundle/ruby/1.8/gems/fcgi-0.9.2.1/lib/fcgi.rb:109:in `each_request'
    from /var/www/html/redmine/vendor/bundle/ruby/1.8/gems/fcgi-0.9.2.1/lib/fcgi.rb:41:in `each'
    from /var/www/html/redmine/vendor/bundle/ruby/1.8/gems/rack-1.4.5/lib/rack/handler/fastcgi.rb:27:in `run'
    from ./public/dispatch.fcgi:20
-bash-4.1$

This is my 'about':

-bash-4.1$ RAILS_ENV=production ruby script/about
Your FCGI gem does not contain the FCGI shared library, running pure ruby instead

sh: darcs: command not found
sh: hg: command not found
sh: bzr: command not found
Environment:
  Redmine version                2.6.4.stable
  Ruby version                   1.8.7-p374 (2013-06-27) [x86_64-linux]
  Rails version                  3.2.21
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.6.11
  Git                            1.7.1
  Filesystem                     
Redmine plugins:
  redmine_github_hook            2.1.0
-bash-4.1$ 

I found similar problem here (from year ago): http://www.redmine.org/boards/2/topics/41999?r=42004
but it was never answered (rather than suggested to use Passenger). Any help will be greatly appreciated.

Thanks!
Tomasz


Replies (3)

RE: FCGI Error when dispatching - Added by Leonel Iturralde over 9 years ago

Hi,
I think the message

Your FCGI gem does not contain the FCGI shared library, running pure ruby instead

means it could not find fcgi.so.

RE: FCGI Error when dispatching - Added by Tomasz Jurczyk over 9 years ago

Hi Leonel,

thanks for your post. Yes, I've been trying to find the solution to this for the last 3 hours. Problem seems to be here:

[root@nlp lib]# pwd
/usr/lib/ruby/gems/1.8/gems/fcgi-0.9.2.1/lib
[root@nlp lib]# ls -l
total 60
-rw-r--r--. 1 root root 14721 May  8 12:55 fcgi.rb
-rwxr-xr-x. 1 root root 44359 May  7 23:00 fcgi.so

One of the first lines in fcgi.rb:

begin
  raise LoadError if ENV["USE_PURE_RUBY_FCGI"]
  require "fcgi.so" 
#rescue LoadError # Load the pure ruby version instead
  # At this point we do have STDERR so put it to some good use
  $stderr.puts "Your FCGI gem does not contain the FCGI shared library, running pure ruby instead" 

Even there is

require "fcgi.so"
it seems to not working properly. I tried to change it to
require "fcgi"
, but it didn't work either.

I tried with passenger without a success. There is some bug in it and it has been reported recently on the passenger issue tracker (~2 weeks ago). This bug concerns passenger specifically on CentOS and is caused partially because of SELinux.

RE: FCGI Error when dispatching - Added by Tomasz Jurczyk over 9 years ago

I finally got it working!
I'm not 100% sure what was the reason (because I tried many possible hacks and solutions), but I mainly added this (and I think this is the reason it started working) in Gemfile.local:

gem "fcgi" 

and called 'bundle install'.

Also, I needed to add these two lines in 'public/dispatch.fcgi'

require 'rubygems'
require 'fcgi'
    (1-3/3)