Bug 63891 - Balancer failover fails for POST with small request Body and CL set
Summary: Balancer failover fails for POST with small request Body and CL set
Status: REOPENED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_proxy_http (show other bugs)
Version: 2.4.41
Hardware: All All
: P2 major with 1 vote (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords: FixedInTrunk
: 63959 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-10-29 13:51 UTC by Rainer Jung
Modified: 2022-10-27 21:32 UTC (History)
3 users (show)



Attachments
Patch for 2.4 (9.38 KB, patch)
2020-02-26 07:11 UTC, Giovanni Bechis
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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
Comment 1 Ruediger Pluem 2020-02-25 20:05:02 UTC
Fixed in trunk via r1869216 and r1869224.
Not yet backported to 2.4.x
Comment 2 Giovanni Bechis 2020-02-26 07:11:59 UTC
Created attachment 37044 [details]
Patch for 2.4

Patch backported to 2.4 branch.
Comment 3 Yann Ylavic 2020-03-03 21:43:49 UTC
*** Bug 63959 has been marked as a duplicate of this bug. ***
Comment 4 Rainer Jung 2020-03-03 23:16:14 UTC
To clarify comment #2: there's a patch backport available, but it has not yet been applied to 2.4.x.
Comment 5 Christophe JAILLET 2020-04-19 08:20:02 UTC
Backported in 2.4.x in r1875111

This is part of 2.4.42
Comment 6 Claude Brisson 2022-10-27 21:32:07 UTC
I observed the problem with version 2.4.54-1~deb11u1 (latest debian bullseye version)

*Some* POST requests with a small body had their body dropped by mod_proxy_http.

I cannot ascertain that this is the exact same problem, but the symptoms are the same. So maybe the fix pushed in 2.4.42 was not complete.

Downgrading to 2.4.38-3+deb10u8 (latest debian buster version) fixed the problem.