Skip to main content

Segfault with Drupal s3 Integration

Back-end Development
Drupal

There is a number of ways one could encounter this error.  But in my case it was a result of using Drupal 7, Amazon s3 integration with the AWS SDK.  This is a fairly popular setup for sites these days which have a large number of assets to store.  And the "Perfect Storm" when using this causes a major issue on the site causing a segfault.

In the Apache error log you find something like:

AH00052: child pid 3211 exit signal Segmentation fault (11)

- or -

sh: 1: cd: can't cd to ~

The result in the browser is either a "white screen of death" or a "No Data Received" message, depending on the browser.

The Cause

There is a php bug in many releases of version 5.4, which on many Linux distributions is the default.  https://bugs.php.net/bug.php?id=66076

This bug is encountered when using the AWS SDK version 1.5.10 is used (other versions may also be an issue).  This is a pretty old version BUT this is the version that the Drupal awssdk module installs/recommends. So if you install this module using drush,`drush make`, etc, this is the version you will end up with.

The Fix

Download the latest AWS SDK release of version 1.x.  https://github.com/amazonwebservices/aws-sdk-for-php/releases

At the time of this writing is 1.6.2

Replacing the contents of the /sites/all/libraries/awssdk with this latest release works around the php issue and should take care of the segfault site error.