Bug 63891

Summary: Balancer failover fails for POST with small request Body and CL set
Product: Apache httpd-2 Reporter: Rainer Jung <rainer.jung>
Component: mod_proxy_httpAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: NEW ---    
Severity: major    
Priority: P2    
Version: 2.4.41   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Rainer Jung 2019-10-29 13:51:46 UTC
Since r1860166 in 2.4.41 the order of request body prefetch and backend connect changed. This is due to backporting r1656259 "mod_proxy_http: don't connect or reuse backend before prefetching request body." or parts of it with the same commit.

Now when a POST request has a small body that fits into the prefetch buffer and has CL set plus the request to the first backend in the balancer fails during the TCP connect to this backend, the failed over request will be send to the next backend with a CL of 0.

Order of execution:

2.4.39:

In proxy_http_handler():
- ap_proxy_determine_connection()
- ap_proxy_check_connection()
- optionally ap_proxy_connect_backend() which might fail.
- ap_proxy_connection_create_ex()
- ap_proxy_http_request() which does prefetch late!

2.4.41:

In proxy_http_handler():
- ap_proxy_determine_connection()
- early ap_proxy_http_prefetch() which does the prefetch!
- optionally again ap_proxy_determine_connection()
- ap_proxy_check_connection()
- optionally ap_proxy_connect_backend() which might fail.
- ap_proxy_connection_create_ex()
- ap_proxy_http_request()

Regards,

Rainer