Hello,

is there any reason why HTTP_INTERNAL_SERVER_ERROR returned by proxy handler cannot failover to another worker? We use FastCGI together with FastCgiExternalServer option and want to use load balancer to prevent situation when external FastCGI instances are stopped or overloaded. mod_fastcgi returns status code 500 in that case but mod_proxy doesn't forward requests to another worker because HTTP_INTERNAL_SERVER_ERROR is handled separately.

We propose to handle HTTP_INTERNAL_SERVER_ERROR in the same way as HTTP_SERVICE_UNAVAILABLE or at least to make this behavior configurable (mod_proxy.c, line 833 - to test it simply remove "break;" line; please see code below).

Thank you in advance for any comments.

Regards

Jiri Tulach

Affected code with comments (mod_proxy.c):

      access_status = proxy_run_scheme_handler(r, worker, conf,
                                               url, NULL, 0);
      if (access_status == OK)
          break;
      else if (access_status == HTTP_INTERNAL_SERVER_ERROR) {
          /* Unrecoverable server error.
!!! * We can not failover to another worker. <== Why? Server is not available because of some failure why not to use different working server?
           * Mark the worker as unusable if member of load balancer
           */
          if (balancer)
              worker->s->status |= PROXY_WORKER_IN_ERROR;
!!!         break;
<== this prevents failover to another worker
      }
      else if (access_status == HTTP_SERVICE_UNAVAILABLE) {
          /* Recoverable server error.
           * We can failover to another worker
           * Mark the worker as unusable if member of load balancer
           */
          if (balancer) {
              worker->s->status |= PROXY_WORKER_IN_ERROR;
          }
      }
      else {
          /* Unrecoverable error.
           * Return the origin status code to the client.
           */
          break;
      }


Reply via email to