This is a known issue, whose fix didn't make it into the Drupal 7 core so far. The culprit can be found within the _drupal_exception_handler(). If another error occurs while handling an exception, it just returns the messages stated in your question without setting HTTP status codes (possibly to avoid further exceptions).
Compare https://www.drupal.org/project/drupal/issues/2666908
The above issue already has a small RTBC patch that solves the problem by adding a 500 status code to the handling of the second exception:
function _drupal_exception_handler($exception) {
require_once DRUPAL_ROOT . '/includes/errors.inc';
try {
// Log the message to the watchdog and return an error page to the user.
_drupal_log_error(_drupal_decode_exception($exception), TRUE);
}
catch (Exception $exception2) {
// Add a 500 status code in case an exception was thrown before the 500
// status could be set (e.g. while loading a maintenance theme from cache).
drupal_add_http_header('Status', '500 Internal Server Error');
// Another uncaught exception was thrown while handling the first one.
// If we are displaying errors, then do so with no possibility of a further uncaught exception being thrown.
if (error_displayable()) {
print '<h1>Additional uncaught exception thrown while handling exception.</h1>';
print '<h2>Original</h2><p>' . _drupal_render_exception_safe($exception) . '</p>';
print '<h2>Additional</h2><p>' . _drupal_render_exception_safe($exception2) . '</p><hr />';
}
}
}
Given the age of that patch, the line numbering differs a little from the current version of bootstrap.inc
. But it still applies cleanly and works as expected.
After you patched your Drupal, you should be able to receive the 500 error code at your load balancer, if Redis is down or the error page can't be created for another reason.
Please note, if your Drupal already sent headers/output to the browser before the error handler kicks in, above patch may have unintended side-effects. You may have to test yourself, whether your webserver still generates 500 server errors for these edge cases.