Ruby Enterprise Edition on Mac OS X LeopardI'm deploying Ruby on Rails apps on Mac OS X Server using Phusion Passenger (aka mod_rails) and Ruby Enterprise Edition. Passenger works beautifully, but REE crashes on startup each time. This seems to be specific to 64-bit Leopard Server — Tiger Server works fine.
A Quick Briefing
For those that don't know, Phusion is currently staging a revolution in the Rails world by addressing one of the platform's biggest obstacles: deployment. Passenger is an Apache module that makes deploying Rails apps nearly as simple as deploying PHP apps. That means no more dealing with CGI.
And beyond simply being a good concept, the actual Passenger installation process sets a new standard of usability in server-side software. The instructions are clear and succinct, and give suggestions when something goes wrong. The developers didn't have to do any of this to be successful, of course. I assume they simply wanted it to be a good experience.
In fact, installing Passenger is just this simple:
gem install passenger
The installer gives you the three lines you need to add to your Apache configuration file. Add those lines, restart Apache, and you're off and running.
In addition to Passenger, Phusion has also created their own fork of Ruby called Ruby Enterprise Edition. This is a version of Ruby specifically tuned for Rails apps running on Passenger, potentially using far fewer resources overall. Again, installation is very simple. You simply download the source and run the installer:
Like Passenger, the REE installer is very conscious about communicating with the user and understands the goal of getting up and running quickly. It attempts to install the MySQL and PostgreSQL gems for you so you can just flip the switch and get started. It also installs into its own sandbox so it doesn't muck up your existing installation.
Once installed, you just need to change the three Passenger configuration lines in your Apache config file to use Ruby Enterprise Edition.
Crashes on Leopard
I've done all of the above on Mac OS X 10.4.11 Tiger Server, and it works great. However, running the exact same installation steps on 64-bit Mac OS X 10.5.5 Leopard Server causes REE to crash every time the app is launched. The Apache virtual host error log looks like this:
*** Unexpected error in Passenger: Cannot spawn application
'/my/site/path': The spawn server has exited unexpectedly.
Here's a snippet of the Ruby Enterprise Edition crash log (full trace available here):
Thread 0 Crashed:
0 libSystem.B.dylib 0x95eefb9e __kill + 10
1 libSystem.B.dylib 0x95f66ec2 raise + 26
2 libSystem.B.dylib 0x95f7647f abort + 73
3 ruby 0x00012570 rb_exc_new + 0
4 ruby 0x00083f5b sigbus + 27 (signal.c:612)
5 libSystem.B.dylib 0x95eee09b _sigtramp + 43
6 ??? 0xffffffff 0 + 4294967295
7 libruby.1.dylib 0x0054db08 rb_intern + 43
8 libruby.1.dylib 0x00509d43 rb_define_module + 32
9 native_support.bundle 0x001b9dbd Init_native_support + 27
10 ruby 0x00010a82 dln_load + 226
11 ruby 0x0002e0f4 rb_require_safe + 1044
While Googling about this, I found a few notes about REE crashing when loading native extensions, and the MySQL gem is once such extension. I'm not certain this is the cause, but the trace above does makes it look that way a bit. When I switch the exact same app back to Leopard's built-in Ruby, everything works fine.
So far, I've only been able to find people running into the same crasher. The good news is that it crashes consistently at the same place, not at some random interval. For reference, I'm using Leopard Server's built-in Apache 2 installation. And when I tried to use Ruby Enterprise Edition, I did install the gems using REE, not the system's Ruby installation.
Ruby Enterprise Edition on Mac OS X Leopard
Posted Nov 05, 2008 — 8 comments below
Posted Nov 05, 2008 — 8 comments below