Probable compiler bug on Raspberry Pi

I was messing around with Varnish on my Pi and was a little peeved that it kept crashing right after start up.

Turns out, this issue is well known to the Googles and everyone who’s tried to run it on the Pi, or at least on Raspbian like I am. If you try running Varnish with -d or -F, you should see something like

I finally tracked down a page where someone said they avoided the crash bug by compiling with CFLAGS="-fno-inline" ./configure && make && make install, but I don’t think that worked. I tried with CFLAGS="-O2 -fno-inline", which should turn on all the -O2 optimizations but disable inlining since that switch comes after the general optimization switch. When I tried it, it was still crashing on me. Then I realized that if someone used just -fno-inline in CFLAGS, it may very well not use any optimization for the compile, defaulting to -O0. I surmised that the inline switch wasn’t causing the bug, but instead one of the other optimizations that gets turned on between optimization level 0 and 2.

Various people reported having success with Varnish by compiling with the --enable-debugging-symbols --enable-diagnostics switches. This explicitly sets -O0 for compile flags, but I was hoping to do better. Instead I used CFLAGS="-O1 -pipe" (-pipe just to try to speed up the compile a bit), and after trying it, no crash. Cool!

Unfortunately, IIRC -O1 is pretty conservative in terms of enabled optimizations, but at least I got some benefit. I suspect there’s just one optimization that causing the failure when using -O2 but the list of extras it enables would take a while to plow through and test. Here’s the list, since my curiosity got the best of me while I was writing this: GCC optimizations.

P.S.: I installed libjemalloc-dev prior to most of the compiles, since jemalloc is reported to do a better job reducing thread contention and memory fragmentation.

Just a little panicked

I nearly lost data permanently last night while trying to merge master and dev branches in my web server’s document root. Thankfully I had a not-so-recent backup that included all the uploaded media that I’d intentionally excluded from the git repo.

Flickr/striatic (Creative Commons)
Seems all is well now, but like every technology, Git is both wonderful and horrible.

Faster webserver on Raspberry Pi

The Raspberry Pi has a 32-bit ARM CPU running at 700MHz by default, although you can usually overclock them somewhat and still enjoy stable behavior. I’m running Raspbian, a Debian-based distribution built for the Pi.

One thing that’s mildly annoying is that running WordPress on the Pi using Nginx and php-fpm has been dog slow, more so than just due to the relatively low clock speed of the CPU. I finally figured out why. I noticed some entries showing up in the Nginx virtual host error log: an upstream response is buffered to a temporary file /var/lib/nginx/fastcgi/3/07/0000000073 while reading upstream. The responses from PHP were being buffered to disk (in this case, an SD card which is the boot device). I googled and found the option I needed to set. Once that was set to 0 and Nginx was restarted, I immediately noticed an improvement in the response time.

Before finding this, I’d tried setting various things in W3 Total Cache plugin for WordPress that didn’t make much of difference. Now some of these caching options produce a noticeable boost in performance in addition to the bump from avoiding disk buffering. Needless to say, I’m much happier with the performance.


Great write up on the glances utility over here.

enabled SSL/TLS on devolve

Big thanks to StartSSL for getting me set up with a signed certificate. Their FAQ on configuring with openssl and nginx worked like a charm. I even got a handy email from them after I thought I was done, telling me that I needed to concatenate the certificate they gave me with a sub cert and root cert for the chain of trust to work properly.

Honestly, the hardest part was making WordPress work properly and to update links to avoid browser warnings. I got most of the way there by using the search and replace plugin – one needs to be very careful with that tool, however. For example, post GUIDs should never change, even if changing the hostname that WP is running on.

climagic is magic

If you’re not following @climagic, you should be forced to listen to this for hours on end:

That’s just one of the many glorious bits from this timeline.

Commafeed UI tweak

If you’re not using Commafeed, (and really, why aren’t you) and you like web-based feed readers, you should check it out – it’s pretty great.

There is one UI flaw that bugged me with the latest commit I grabbed today: the left sidebar with the list of feeds was too wide. Luckily, Commafeed makes it easy to adjust the CSS of any theme. Click the settings button, then the Appearance tab, and add the following to the Custom CSS box:

That makes the separator between the main content area and left sidebar shift to the left by 50 pixels. All that glaring extra white space is gone now.

Overturn ECPA Now

UPDATE: We made it! As of right now, there are 105,628 signatures on the petition. Thank you! Can’t wait to hear what the white house says on this.

Please sign this petition! I’m having trouble believing that it’s taken this long for people to take a minute to sign it. Is the level of apathy about this so great that no one thinks anything they do will make a difference? Or perhaps it’s more “I haven’t done anything wrong, so I have nothing to hide.” Wrong. Do you want privacy? Do you want strangers to know what’s in your medical records? Your bathroom medicine cabinet? Your bedroom?

Yeah. Sign it.

Locamatic – automatic Mac location changer

UPDATE: locamatic is not maintained anymore as far as I can tell. Check out my post on a replacement: ControlPlane

Glad I found Locamatic, because I need to set different network location profiles on my Mac based on where I am in order for the network to function properly. It works by checking which wifi or ethernet connection is active, and setting the location based on which network you associate with that location. It installs as a pref pane and lets you add, change or delete the location to network entries, as well as select a default printer to use while on a particular network.