Bug 66537 - large request serving times logged since upgrade to 2.4.56
Summary: large request serving times logged since upgrade to 2.4.56
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Core (show other bugs)
Version: 2.4.56
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-03-22 00:25 UTC by hamish@risingsoftware.com
Modified: 2023-05-17 07:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hamish@risingsoftware.com 2023-03-22 00:25:56 UTC
I am logging the time to serve a request using %D (or %{us}T) in a log format.

Since upgrading from 2.4.55 to 2.4.56, I see a lot of requests logged as taking over 10 seconds (and up to 35 seconds) to process.

All my traffic is reverse proxied to other applications over HTTP, ie I am using HTTPD for SSL termination and request routing.

For example, one server recorded 100 requests all day requiring >10s yesterday, but has already recorded >4500 in 5 hours since installing 2.4.56.

I don't see any difference when looking at the timing in the browser network pane. The affected traffic seems to be a mix of HTTP/1.1 and 2.0.

I have keepalives on with a KeepAliveTimeout of 35. I wonder if it is counting time until the connection is closed now?
Comment 1 Teodor Milkov 2023-05-10 15:45:19 UTC
I've experimented a bit with h2c, a straightforward HTTP/2 command-line client. This tool allows you to open a persistent connection (connect), send requests, and then close it (disconnect). I ran some tests using both the new Apache 2.4.57 and the older 2.4.54. Interestingly, there seems to have been a shift in the login behavior.

Here's how I tested: I opened an HTTP/2 connection (connect), sent GET requests to a script that echoes and induces sleep between requests, and finally closed the connection (disconnect). With the older Apache version, every request within a connection was logged immediately, and the service time (%D) in access_log was approximately 1.5ms.

However, with the new Apache, each request was logged either upon disconnect or when the next request was submitted within the same connection. Here, the service time (%D) in access_log included both the service time and idle time between the previous and the current request, or to disconnect. Notably, the timestamp of the request submission (%t) was logged correctly.

Moreover, in a connect/get/disconnect scenario, the older Apache version logged %D at around 1.5ms, while the new Apache version logged a notably higher time of about 6.5ms.
Comment 2 Stefan Eissing 2023-05-11 07:35:23 UTC
Thanks for the report. Will look into the issue.

From what I cant tell, the new mod_http2 does not seem to cleanup finished requests as timely as before. And the cleanup causes the access log to be written and the time counted.

It seems cleanup sometimes happens after the *next* activity on the connection, which then gives overlong run times and late access logging.
Comment 3 Stefan Eissing 2023-05-11 07:38:05 UTC
Opened <https://github.com/icing/mod_h2/issues/253> for this.
Comment 4 Stefan Eissing 2023-05-11 09:35:32 UTC
Please see <https://github.com/icing/mod_h2/pull/254> for a fix.

I reproduced the wrong behaviour in a test case. Hope this works in your environments too. 

Could you verify? Thanks.
Comment 5 Stefan Eissing 2023-05-12 11:57:56 UTC
Fixed in r1909769 and proposed to backport to 2.4.x
Comment 6 Teodor Milkov 2023-05-17 05:55:44 UTC
With changes from https://github.com/icing/mod_h2/pull/254 logging is working as expected for me.
Comment 7 hamish@risingsoftware.com 2023-05-17 06:26:50 UTC
Fine for me also.
Comment 8 Stefan Eissing 2023-05-17 07:18:08 UTC
Thanks for reporting back!