Suboptimized
The Instiki installation on golem has performed quite solidly. It’s not the fastest Web application you’ll ever see, but it’s been pretty darned stable. Since I was giving some talks this summer, I installed a copy on my laptop, so that I could serve (and, for that matter, prepare) the slides locally.
That proved to be nothing but a headache. The damned thing would segfault at the drop of a hat. Eventually, I gave up, and relied on the wonders of the internet to deliver my slides from my office in Austin to wherever I happened to be.
A little bit of googling around revealed that these Segmentation Fault errors are not an uncommon problem. And it’s not Instiki; the problem lies with Ruby itself. In fact, it appears to be a problem, not just with the Fink-installed version of Ruby that I was using, but with any late-model Ruby, compiled with GCC 4.0.
Now that I’m back in Austin, I set about to try to fix the matter.
The key insight came from this blog post, which pointed to a problem with GCC 4’s optimizations. My solution, which was a little less drastic than his, was to change
SetCFLAGS: -g -Os
to
SetCFLAGS: -g -O
in /sw/fink/dists/unstable/main/finkinfo/languages/ruby18.info
and then do a
fink rebuild ruby ruby18-dev sqlite3-rb18
(and reinstall the itex2MML Ruby bindings). Instiki’s been a bit slower (but rock-solid stable) since then.
Mind you, you should only do this if Ruby has trouble on your platform, too. As I said, it works just fine with the default compiler optimizations on golem (a G5 PowerMac).
Re: Suboptimized
-Os optimizes for size instead of speed. For example, it does not inline functions. Perhaps with the exception of embedded systems nobody would want that.
The best optimization in gcc is -O3 (which is the same as any number >3).
By the way, how secure is the setup? Isn’t this similar to running a web server with cgi? How long did it take for the apache people to get their default setup really secure? ;-) Did you try the java-based ruby interpreter?