Bug 66801 - Numbers reported by mod_status /server-status are doubled for HTTP/2 requests
Summary: Numbers reported by mod_status /server-status are doubled for HTTP/2 requests
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_http2 (show other bugs)
Version: 2.4.57
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-26 10:09 UTC by herr.ernst
Modified: 2024-04-07 10:09 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description herr.ernst 2023-07-26 10:09:20 UTC
When we enabled HTTP/2 on our servers, we noticed that Apache volume and requests (as reported by /server-status from mod_status) nearly doubled. It turned out that all HTTP/2 requests are counted twice, both for number of requests and volume. Reproduced with local server:

# get 1G large file

$ apachectl restart
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)" 
Total Accesses: 0
Total kBytes: 0
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 1 # server-status is also a request
Total kBytes: 1
$ mkfile 1g /var/www/1g.bin
$ curl -o /dev/null -k https://localhost:8443/1g.bin                           
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1024M  100 1024M    0     0   732M      0  0:00:01  0:00:01 --:--:--  736M
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 4
Total kBytes: 2097731
$ curl -o /dev/null -k https://localhost:8443/1g.bin                           
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1024M  100 1024M    0     0   740M      0  0:00:01  0:00:01 --:--:--  743M
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 7
Total kBytes: 4195461

# try with multiple 1M files

$ apachectl restart
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 0
Total kBytes: 0
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 1
Total kBytes: 1
$ mkfile 1m /var/www/1m.bin
$ h2load -c 10 -n 1000 https://localhost:8443/1m.bin > /dev/null
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 2002
Total kBytes: 2048615

# try with HTTP/1.1, numbers are correct here

$ apachectl restart
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 0
Total kBytes: 0
$ h2load --h1 -c 10 -n 1000 https://localhost:8443/1m.bin > /dev/null          
$ curl -s "http://localhost:8080/server-status?auto" | grep -E "Total (Acc|kB)"
Total Accesses: 1001
Total kBytes: 1024001
Comment 1 Stefan Eissing 2023-07-26 12:20:07 UTC
Thank you for the report. The bug should be fixed with r1911291 in trunk and I'll propose this to backport to 2.4.x. The double counting of transferred bytes had already been fixed in a previous change and is part of 2.4.x already.
Comment 2 herr.ernst 2023-07-26 17:06:14 UTC
Thanks for your answer. Both issues are fixed for me in trunk, but in 2.4.x I also get doubled bytes.
Comment 3 Stefan Eissing 2023-07-27 07:48:36 UTC
Just so that I get that correctly: you see double bytes in 2.4.x with r1911291 applied there?
Comment 4 herr.ernst 2023-07-27 13:13:47 UTC
Sorry, maybe I messed up something or didn't clean everything before rebuilding. With the patch applied it works correctly. Thanks again.
Comment 5 Stefan Eissing 2023-07-27 13:42:12 UTC
Wonderful and thanks for the update! I was starting to doubt my testcases.;)
Comment 6 Christophe JAILLET 2024-04-07 10:09:27 UTC
This was backported in 2.4.x branch in r1911858 and is part of version 2.4.58.