<p>I've eventually tracked down this peculiar <code>ERR_EMPTY_RESPONSE</code> to a php error buried deep in my apache logs - <code>zend_mm_heap corrupted</code>. So as it turns out nothing to do with Capistrano (or Craft) at all! This <code>zend_mm_heap</code> error is a php memory error that I seem to have solved by upgrading my version of PHP after unsuccessfully upping my <code>output_buffer</code> as suggested in <a href="https://stackoverflow.com/questions/2247977/what-does-zend-mm-heap-corrupted-mean">this stackoverflow thread</a>. It's worth noting that there was nothing in the Craft log about this error, no mention of anything untoward. The <code>Craft\HttpException</code> I found above is, I believe, essentially a '404' error as my site was running in 'offline mode' so requests had to be run through <code>_enforceSystemStatusPermissions</code>.</p>

<p>I did initially have some issues with permissions with Capistrano where my server was setting new files created by craft to 644 www-data:www-data and therefore my user couldn't edit these files, despite being in the www-data group, and so Capistrano was having a hard time removing old releases. I've fixed this by adding a umask 002 to /etc/apache2/envvar.</p>

<p>Now that the <code>zend_mm_heap</code> error seems to be behaving, and my permissions are correct, deploying with Capistrano is working rather well. For future reference, my linked dirs config looks like this:</p>

<pre><code>set :linked_dirs, %w{public/resources craft/config/local craft/storage}
</code></pre>

<p><code>public/resources</code> is my (single) craft asset source, <code>craft/config/local</code> are my server-specific config files as suggested <a href="https://github.com/BarrelStrength/Craft-Multi-Environment-Config" rel="nofollow noreferrer">here</a> which is working nicely for me. <code>craft/storage</code> is obviously the craft storage folder that is shared between releases.</p>

<p>In terms of deployment, I think Capistrano (and other tools of a similar ilk) is great. I'm hosting my repository in a private BitBucket account and push new changes onto the master branch. I have two stages set up :production and :staging which deploy to two different vhosts on my server (staging domain is test.domain.com).</p>

<p>My stage configuration looks like this (for staging)</p>

<pre><code>set :stage, :staging

set :deploy_to, "/var/www/domain-test"

# Allow user to define which branch to push, e.g.
# BRANCH=my-new-feature cap staging deploy
set :branch, ENV['BRANCH'] || "staging"
</code></pre>

<p>This last line is really helpful if I want to quickly test something on the master branch without having to merge it into the staging branch and push and deploy.</p>

<p>I hope that helps someone who comes across a similar issue. If anyone wants more info about my Capistrano set up, let me know. I highly recommend it as a method of deployment, once you figure out your (inevitable and strange) server errors!</p>

CC BY-SA 3.0
2015-04-03T08:18:14.443Z
2015-04-03T08:24:00.213Z
2017-05-23T12:38:53.957Z
lowe_22
<p>I'm having some issues with my install of craft on a staging server.</p>

<p>I'm deploying using Capistrano, and (perhaps wrongly) added craft/storage to linked_dirs (to share between deployments). Since doing that, things have not been going so well with my installation. I keep get "No response" screen in the browser, <code>(Error code: ERR_EMPTY_RESPONSE)</code>. I also get "unknown error occurred" messages when browsing round the admin doing normal things like updating entries etc.</p>

<p>The only consistent error is this one:</p>

<pre><code>2015/03/26 17:33:53 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php:916
Stack trace:
#0 /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php(230): Craft\WebApp-&gt;_enforceSystemStatusPermissions()
#1 /var/www/50th/releases/20150326171328/craft/app/framework/base/CApplication.php(180): Craft\WebApp-&gt;processRequest()
#2 /var/www/50th/releases/20150326171328/craft/app/index.php(62): CApplication-&gt;run()
#3 /var/www/50th/releases/20150326171328/public/index.php(19): require_once('/var/www/50th/r...')
#4 {main}
REQUEST_URI=/
---
2015/03/26 17:33:53 [error] [application]
</code></pre>

<p>It's worth noting that the site is in offline-mode.</p>

<p>Any ideas?!</p>

<p><strong>Update:</strong>
I've found a consistent error message when trying to access "/admin/users":
[DOMAINNAME...]/index.php/admin/actions/elementIndex/getElements net::ERR_EMPTY_RESPONSE</p>

<p>Is being returned by jQuery trying to access elements. Does this help at all?</p>

CC BY-SA 3.0
2015-03-26T20:10:26.463Z
I've got 0 experience with Capistrano, so I can only offer some general advice. `ERR_EMPTY_RESPONSE` is just Chome's way of saying "I expected to get a response, but I got nothing back". Usually some fatal error occurring on the server side.  Re: "unknown error occurred" - If you look i your `craft/storage/runtime/logs` folder for `[error]`, then you can find the underlying error message. Also worth checking for a `phperrors.log` file in that same folder.
Brad Bell
CC BY-SA 3.0
2015-03-26T22:54:00.317Z
Unfortunately it's not logging an error every time the "Unknown Error Occured" red box notification appears in the dashboard. It seems to be something problematic relating to `/admin/actions/elementIndex/getElements` - Issues mainly occurring on the index pages for entries. I think it's some sort of linux/server permissions issue, posibly to do with the storage folder...
lowe_22
CC BY-SA 3.0
2015-04-01T10:47:38.490Z
@BradBell How would you go about deploying craft then? I'm having a lot of issues with Craft amd capistrano,. I keep getting ERROR_EMPTY_REPONSE on the front end, and lots via jQuery on the backend too. Do you hve any ideas what might be causing this? Craft can read write to storage directory. I don't understand what's going on!
lowe_22
CC BY-SA 3.0
2015-04-01T17:18:08.347Z
Look at the call to getElements in your browser's console's Network tab. What's the response coming back from that request.
Brad Bell
<deployment>
Craft storage dir as linked in capistrano
# Craft storage dir as linked in capistrano

(Asked by: username_0 on 2015-03-26)

I'm having some issues with my install of craft on a staging server.
I'm deploying using Capistrano, and (perhaps wrongly) added craft/storage to linked_dirs (to share between deployments). Since doing that, things have not been going so well with my installation. I keep get "No response" screen in the browser, (Error code: ERR_EMPTY_RESPONSE). I also get "unknown error occurred" messages when browsing round the admin doing normal things like updating entries etc.
The only consistent error is this one:
2015/03/26 17:33:53 [error] [exception.Craft\HttpException.503] exception 'Craft\HttpException' in /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php:916
Stack trace:
#0 /var/www/50th/releases/20150326171328/craft/app/etc/web/WebApp.php(230): Craft\WebApp->_enforceSystemStatusPermissions()
#1 /var/www/50th/releases/20150326171328/craft/app/framework/base/CApplication.php(180): Craft\WebApp->processRequest()
#2 /var/www/50th/releases/20150326171328/craft/app/index.php(62): CApplication->run()
#3 /var/www/50th/releases/20150326171328/public/index.php(19): require_once('/var/www/50th/r...')
#4 {main}
REQUEST_URI=/
---
2015/03/26 17:33:53 [error] [application]

It's worth noting that the site is in offline-mode.
Any ideas?!
Update:
I've found a consistent error message when trying to access "/admin/users":
[DOMAINNAME...]/index.php/admin/actions/elementIndex/getElements net::ERR_EMPTY_RESPONSE
Is being returned by jQuery trying to access elements. Does this help at all?

**Tags:** deployment

> **Comments:**
> **username_1**: I've got 0 experience with Capistrano, so I can only offer some general advice. `ERR_EMPTY_RESPONSE` is just Chome's way of saying "I expected to get a response, but I got nothing back". Usually some fatal error occurring on the server side.  Re: "unknown error occurred" - If you look i your `craft/storage/runtime/logs` folder for `[error]`, then you can find the underlying error message. Also worth checking for a `phperrors.log` file in that same folder.  
> **username_0**: Unfortunately it's not logging an error every time the "Unknown Error Occured" red box notification appears in the dashboard. It seems to be something problematic relating to `/admin/actions/elementIndex/getElements` - Issues mainly occurring on the index pages for entries. I think it's some sort of linux/server permissions issue, posibly to do with the storage folder...  
> **username_0**: @BradBell How would you go about deploying craft then? I'm having a lot of issues with Craft amd capistrano,. I keep getting ERROR_EMPTY_REPONSE on the front end, and lots via jQuery on the backend too. Do you hve any ideas what might be causing this? Craft can read write to storage directory. I don't understand what's going on!  
> **username_1**: Look at the call to getElements in your browser's console's Network tab. What's the response coming back from that request.  

---

## 1 answers

### Answer by username_0 on 2015-04-03. Score: 2 | Accepted answer

I've eventually tracked down this peculiar ERR_EMPTY_RESPONSE to a php error buried deep in my apache logs - zend_mm_heap corrupted. So as it turns out nothing to do with Capistrano (or Craft) at all! This zend_mm_heap error is a php memory error that I seem to have solved by upgrading my version of PHP after unsuccessfully upping my output_buffer as suggested in this stackoverflow thread. It's worth noting that there was nothing in the Craft log about this error, no mention of anything untoward. The Craft\HttpException I found above is, I believe, essentially a '404' error as my site was running in 'offline mode' so requests had to be run through _enforceSystemStatusPermissions.
I did initially have some issues with permissions with Capistrano where my server was setting new files created by craft to 644 www-data:www-data and therefore my user couldn't edit these files, despite being in the www-data group, and so Capistrano was having a hard time removing old releases. I've fixed this by adding a umask 002 to /etc/apache2/envvar.
Now that the zend_mm_heap error seems to be behaving, and my permissions are correct, deploying with Capistrano is working rather well. For future reference, my linked dirs config looks like this:
set :linked_dirs, %w{public/resources craft/config/local craft/storage}

public/resources is my (single) craft asset source, craft/config/local are my server-specific config files as suggested here which is working nicely for me. craft/storage is obviously the craft storage folder that is shared between releases.
In terms of deployment, I think Capistrano (and other tools of a similar ilk) is great. I'm hosting my repository in a private BitBucket account and push new changes onto the master branch. I have two stages set up :production and :staging which deploy to two different vhosts on my server (staging domain is test.domain.com).
My stage configuration looks like this (for staging)
set :stage, :staging

set :deploy_to, "/var/www/domain-test"

# Allow user to define which branch to push, e.g.
# BRANCH=my-new-feature cap staging deploy
set :branch, ENV['BRANCH'] || "staging"

This last line is really helpful if I want to quickly test something on the master branch without having to merge it into the staging branch and push and deploy.
I hope that helps someone who comes across a similar issue. If anyone wants more info about my Capistrano set up, let me know. I highly recommend it as a method of deployment, once you figure out your (inevitable and strange) server errors!


---

