Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 289526 - www-apache/passenger-2.2.8 crash on rails request with seg fault in ApplicationPool server
Summary: www-apache/passenger-2.2.8 crash on rails request with seg fault in Applicati...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Server (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Apache Team - Bugzilla Reports
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-17 21:46 UTC by Scott
Modified: 2011-04-26 18:15 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
the 00_default_vhost.conf file (00_default_vhost.conf,1.53 KB, text/plain)
2009-10-17 21:51 UTC, Scott
Details
Passenger configuration (30_mod_passenger.conf,2.83 KB, text/plain)
2009-10-17 21:52 UTC, Scott
Details
The default include (default_vhost.include,2.89 KB, text/plain)
2009-10-17 21:53 UTC, Scott
Details
paludis info of passenger (passenger.info,19.73 KB, text/plain)
2010-01-03 15:45 UTC, Samu Voutilainen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott 2009-10-17 21:46:31 UTC
I installed www-apache/passenger-2.2.5, configuration attached.

For any rails dependent request (e.g. going to a controller, or getting the info on index.html), it returns the standard apache 500 internal server error.
The error_log says:
 Unexpected error in mod_passenger: The ApplicationPool server unexpectedly closed the connection while we're reading a response for the 'get' command.
  Backtrace:
     (backtrace support disabled during compile time)
[Sun Oct 18 05:11:56 2009] [notice] child pid 21821 exit signal Segmentation fault (11)



If I switch the LoadModule and PassengerRoot properties to use those installed by the gem, this does not happen.


Reproducible: Always

Steps to Reproduce:
1. emerge =www-apache/passenger-2.2.5
2. add "-D PASSENGER" to APACHE2_OPTS
3. add "RailsEnv development" to /etc/apache2/modules.d/30_mod_passenger.conf
   (only really because the test app doesn't have production defined)
4. add "RailsBaseURI /test" to VirtualHost in 00_default_vhost.conf
5. Create rails app at /var/www/localhost/rails/
5a. rails test
5b. ruby script/generate controller blog
5c. echo "Hello" >> app/views/blog/index.rhtml
6. ln -s /var/www/localhost/rails/test /var/www/localhost/htdocs/test

Navigate to http://ip/test/blog
Actual Results:  
500 error from apache

Expected Results:  
the index.rhtml page to be displayed

APACHE2_OPTS="-D DEFAULT_VHOST -D INFO -D LANGUAGE -D SSL -D SSL_DEFAULT_VHOST -D PHP5 -D PASSENGER"


apache-2.2.11-r2
rails-2.3.4
ruby-1.8.6_p369
passenger-2.2.5


Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.1.2, glibc-2.9_p20081201-r2, 2.6.29-gentoo-r5 x86_64)
=================================================================
System uname: Linux-2.6.29-gentoo-r5-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-1.12.11.1
Timestamp of tree: Sat, 03 Oct 2009 14:45:01 +0000
app-shells/bash:     4.0_p28
dev-lang/python:     2.4.6, 2.5.4-r3, 2.6.2-r1
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.5, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="amd64"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=nocona -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="ftp://ftp.ussg.iu.edu/pub/linux/gentoo ftp://lug.mtu.edu/gentoo/"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X aac acl alsa amd64 apache2 berkdb bzip2 cddb cdr cli cracklib crypt cups dri dts dvd dvdr encode fastcgi firefox flac fortran ftp gdbm gif gpm hardened iconv ipv6 isdnlog jpeg jpeg2k lirc midi mmx modules mp3 mudflap multilib mysql mysqli ncurses nls nptl nptlonly ogg opengl openmp pam pcre perl php png pppd python readline reflection ruby session smp spl sqlite sqlite3 sse sse2 ssl subversion sysfs tcpd unicode vorbis webinterface xine xml xmlrpc xorg xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PORTDIR_OVERLAY
Comment 1 Scott 2009-10-17 21:51:01 UTC
Created attachment 207430 [details]
the 00_default_vhost.conf file

The mpm section works with gem installation of passenger whether commented or not.
Comment 2 Scott 2009-10-17 21:52:27 UTC
Created attachment 207432 [details]
Passenger configuration

The two commented lines at the top are the paths for the gem installation of passenger.
Comment 3 Scott 2009-10-17 21:53:44 UTC
Created attachment 207434 [details]
The default include 

No real changes from when I installed apache, but I did try giving the test dir it's own directory.
Comment 4 Hans de Graaff gentoo-dev Security 2009-11-26 12:42:41 UTC
Could you also try this with passenger 2.2.7, which I just added to the tree?
Comment 5 Michael Rhyner 2009-12-17 09:42:20 UTC
I've seen that the ebuild www-apache/passenger-2.2.7 still suffers from the same problem (exactly the same errors):

[ pid=16521 file=ext/apache2/Hooks.cpp:725 time=2009-12-16 17:59:42.753 ]:
  Unexpected error in mod_passenger: The ApplicationPool server unexpectedly closed the connection while we're reading a response for the 'get' command.
  Backtrace:
     (backtrace support disabled during compile time)

[Wed Dec 16 17:59:43 2009] [notice] child pid 16516 exit signal Segmentation fault (11)

It worked for me too using the passenger ruby gem...

My ebuild info:
Portage 2.1.6.13 (!/usr/local/portage/profiles/default/linux/x86/2008.0/stepping-stone.ch/vserver, gcc-4.1.2, glibc-2.9_p20081201-r2, 2.6.22-vs2.2.0.7-gentoo x86_64)
=================================================================
System uname: Linux-2.6.22-vs2.2.0.7-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_5130_@_2.00GHz-with-gentoo-2.0.0
Timestamp of tree: Wed, 16 Dec 2009 15:15:02 +0000
app-shells/bash:     4.0_p35
dev-lang/python:     2.6.4
dev-python/pycrypto: 2.0.1-r8
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.2.5
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.63-r1
sys-devel/automake:  1.10.2
sys-devel/binutils:  2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium4 -O2 -pipe -msse2 -mmmx -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/eselect/postgresql /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=pentium4 -O2 -pipe -msse2 -mmmx -fomit-frame-pointer"
DISTDIR="/var/tmp/distfiles"
FEATURES="ccache distlocks fixpackages parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j5"
PKGDIR="/usr/local/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://invalid-host-since-we-dont-sync-in-vservers/gentoo-portage"
USE="acpi bash-completion berkdb bzip2 cli cracklib crypt cups cxx dri fortran gdbm iconv md5sum mmx modules mudflap ncurses nls nptl nptlonly openmp pam pcre perl pppd python readline reflection session spl sse sse2 ssl sysfs unicode userlocales vim-syntax x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_default authn_file authz_default authz_groupfile authz_host authz_owner authz_user autoindex dir env imagemap include info log_config logio mime mime_magic negotiation rewrite setenvif status unique_id userdir usertrack" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa via vmware voodoo"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

Any further ideas?

Thanx for further inspection
Mike
Comment 6 Hans de Graaff gentoo-dev Security 2009-12-27 17:47:49 UTC
I've just added passenger 2.2.8 to the tree, perhaps that solves the issue, although nothing jumped out while reading the changelog.

If that doesn't help then my next guess would be that the gem compiles the code with slightly different CFLAGS. We would need to compare them and/or use the ruby compilation flags to see if that makes a difference.
Comment 7 Samu Voutilainen 2010-01-03 15:45:30 UTC
Created attachment 215035 [details]
paludis info of passenger

Happens here too. Paludis info attached, if it is any help.
Comment 8 Hans de Graaff gentoo-dev Security 2010-01-03 15:58:26 UTC
(In reply to comment #6)

> If that doesn't help then my next guess would be that the gem compiles the code
> with slightly different CFLAGS. We would need to compare them and/or use the
> ruby compilation flags to see if that makes a difference.

The ruby ebuild does two things with CFLAGS: remove -fomit-frame-pointer (but Samu, you don't seem to have that set), and it adds -fno-strict-aliasing.

Could you try to compile and install passenger via the ebuild with this added?

Adding "append-flags -fno-strict-aliasing" at the top of src_compile() should be fine.

Comment 9 Kai Krakow 2010-01-19 20:43:47 UTC
Adding append-flags and filter-flags as suggested does not help. Last known good version is 2.2.4 for me. Maybe one should do a bisect on the original source?
Comment 10 Hans de Graaff gentoo-dev Security 2010-01-23 13:43:52 UTC
(In reply to comment #9)
> Adding append-flags and filter-flags as suggested does not help. Last known
> good version is 2.2.4 for me. Maybe one should do a bisect on the original
> source?

Others have reported that installing the gem directly did work for them. Is that also the case for you?
Comment 11 Hans de Graaff gentoo-dev Security 2010-01-23 13:59:22 UTC
I've just added passenger 2.2.9 to the tree, so getting feedback on that would be useful.
Comment 12 Kai Krakow 2010-01-24 13:32:35 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > Adding append-flags and filter-flags as suggested does not help. Last known
> > good version is 2.2.4 for me. Maybe one should do a bisect on the original
> > source?
> 
> Others have reported that installing the gem directly did work for them. Is
> that also the case for you?

It's a production system so I don't want to pollute it with manually installed gems. But I soon have a pre-production system up and running to test with.
Comment 13 Kai Krakow 2010-01-24 13:41:10 UTC
> Others have reported that installing the gem directly did work for them. Is
> that also the case for you?

I cannot find the link where I got this information but I saw a report where someone found that dropping -O2 from the CFLAGS fixed it.
Comment 14 Alexandre Gauthier 2010-02-07 19:50:52 UTC
I also confirm that removing -O2 from the CFLAGS fixes the issues.
Can we get an updated ebuild with "filter-flags -O2" ?
Comment 15 Kai Krakow 2010-02-08 13:02:24 UTC
(In reply to comment #14)
> I also confirm that removing -O2 from the CFLAGS fixes the issues.
> Can we get an updated ebuild with "filter-flags -O2" ?

I suggest we'd better find out which flag or combination of flag the O2 optimization level activates for this bug to trigger and filter/explicitly disable that.
Comment 16 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-02-09 02:02:26 UTC
If somebody feels like testing try adding -fno-strict-aliasing…

On the other hand I only see three info blocks, and they all declare GCC 4.1… can somebody try with 4.3 and report back?
Comment 17 Hans de Graaff gentoo-dev Security 2010-02-17 19:56:20 UTC
(In reply to comment #16)
> If somebody feels like testing try adding -fno-strict-aliasing…

Both 2.2.8 and 2.2.9 already add -fno-strict-aliasing to the ebuild by default.

Looking some more into the CFLAGS that ruby uses it seems that it adds -fPIC to the CFLAGS by default. Could you guys try that as well?
Comment 18 Diego Elio Pettenò (RETIRED) gentoo-dev 2010-02-17 20:01:16 UTC
If -fPIC was skipped for .so files, it would fail to build on amd64 and would produce a TEXTREL on x86.
Comment 19 Hans de Graaff gentoo-dev Security 2010-02-17 20:05:32 UTC
(In reply to comment #18)
> If -fPIC was skipped for .so files, it would fail to build on amd64 and would
> produce a TEXTREL on x86.

Ahum, yes, it is already used to build passenger. Sorry.
Comment 20 Hans de Graaff gentoo-dev Security 2010-02-26 06:32:14 UTC
I've just added passenger 2.2.10 to CVS. I'm hopeful that this version may fix things:

* Fixed some file descriptor passing problems, which previously could lead to mysterious crashes.
Comment 21 RuncZ 2010-03-11 11:30:20 UTC
unmasking passenger-2.2.10 did not do the trick (got the same error), however dropping -O3 from cflags did.

www-servers/apache-2.2.14-r1
dev-ruby/rails-2.3.5
dev-lang/ruby-1.8.7_p249
www-apache/passenger-2.2.10

CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"

stable x86 system
# ls -l /etc/make.profile
lrwxrwxrwx 1 root root 51 Oct 22 15:03 /etc/make.profile -> /usr/portage/profiles/default/linux/x86/10.0/server



Also (dunno if here is the right place to say it, but) this message:

 * Configuration file installed as
 *     /etc/apache2/modules.d/30_mod_passenger-2.0.1.conf

is wrong because configuration file is installed as /etc/apache2/modules.d/30_mod_passenger.conf
Comment 22 Hans de Graaff gentoo-dev Security 2010-08-08 17:36:56 UTC
(In reply to comment #21)

> Also (dunno if here is the right place to say it, but) this message:
> 
>  * Configuration file installed as
>  *     /etc/apache2/modules.d/30_mod_passenger-2.0.1.conf
> 
> is wrong because configuration file is installed as
> /etc/apache2/modules.d/30_mod_passenger.conf

This appears to be a bug in the apache-module eclass using the source name instead of the installation file name. It's not something I can fix. 
Comment 23 Hans de Graaff gentoo-dev Security 2010-08-08 17:38:26 UTC
It turned out I had only troublesome server as well. I've just upgraded it to passenger 2.2.15 and that finally seems to work correctly out of the box. Does this version also fix the issues others have had?
Comment 24 Benedikt Böhm (RETIRED) gentoo-dev 2010-08-08 18:49:10 UTC
(In reply to comment #22)
> (In reply to comment #21)
> 
> > Also (dunno if here is the right place to say it, but) this message:
> > 
> >  * Configuration file installed as
> >  *     /etc/apache2/modules.d/30_mod_passenger-2.0.1.conf
> > 
> > is wrong because configuration file is installed as
> > /etc/apache2/modules.d/30_mod_passenger.conf
> 
> This appears to be a bug in the apache-module eclass using the source name
> instead of the installation file name. It's not something I can fix. 

thanks for spotting it. i have fixed it in the eclass.
Comment 25 Hans de Graaff gentoo-dev Security 2011-04-26 18:15:35 UTC
I'm closing this bug as fixed since 2.2.15 fixed things for me and there was no further feedback. If you still have issues, please upgrade to passenger-3.0.7 first before reporting.