Bug 63300 - mod_status lists BusyWorkers IdleWorkers keys twice
Summary: mod_status lists BusyWorkers IdleWorkers keys twice
Status: RESOLVED FIXED
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: mod_status (show other bugs)
Version: 2.4.38
Hardware: All All
: P2 regression (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-28 16:12 UTC by Christian Zuckschwerdt
Modified: 2024-04-07 10:29 UTC (History)
1 user (show)



Attachments
mod_status.patch (1002 bytes, patch)
2023-01-18 14:34 UTC, Tomas Korbar
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Zuckschwerdt 2019-03-28 16:12:52 UTC
Overview:

mod_status server-status?auto lists the keys BusyWorkers and IdleWorkers twice.

Steps to Reproduce:

wget -O - 'http://localhost/server-status?auto'

Actual Results:

I see e.g.
...
DurationPerReq: 8.53412
BusyWorkers: 1
IdleWorkers: 49
Processes: 2
Stopping: 0
BusyWorkers: 1
IdleWorkers: 49
ConnsTotal: 2
...

Expected Results:

Up to release 2.4.34 the output was e.g.
...
Uptime: 3
ReqPerSec: 0
BytesPerSec: 0
BusyWorkers: 1
IdleWorkers: 4
Scoreboard:
...

Additional Information:

The change was introduced with "mod_status: Complete the data shown for async" ( https://github.com/apache/httpd/commit/6befc1893bea72320388b84fd879a4533e29b244 ) from 2018-08-07 released with httpd 2.4.35.

Is there a contract that the keys should be unique?
Comment 1 Christian Zuckschwerdt 2019-03-28 17:13:51 UTC
Suggested fix would be to make https://github.com/apache/httpd/blob/2.4.39/modules/generators/mod_status.c#L554

 ap_rprintf(r, "BusyWorkers: %d\nIdleWorkers: %d\n", busy, ready);

conditional on is_async. Not sure though if both outputs could report different values?
Comment 2 Stefan Neufeind 2021-03-09 07:01:24 UTC
Would be great to avoid duplicate values here. In the meantime others like collectd have implemented workarounds. But imho duplicate values should be prevented at the source.

https://github.com/collectd/collectd/pull/3131
Comment 3 Rainer Jung 2021-03-09 10:30:52 UTC
I would prefer to rename to fields for the async values, because they are calculated in an independent way. Deltas may point to problems. For instance:

BusyWorkers => BusyAsyncWorkers
IdleWorkers => IdleAsyncWorkers

Although of course in the async case there are only async workers, no others.
Comment 4 Stefan Neufeind 2022-05-02 11:42:46 UTC
Either way. But having a solution would be great.
Comment 5 Tomas Korbar 2023-01-18 14:34:29 UTC
Created attachment 38466 [details]
mod_status.patch

Hi,
i would also like this to be resolved. I Reproduced this issue on Fedora-Rawhide.
My proposal is to remove the first set of BusyWorkers IdleWorkers when ?auto query is supplied and let only the second set be printed out with correct values which count with gracefully finishing threads but renaming is also ok.

Thanks for any help.
Comment 6 Tomas Korbar 2023-04-26 08:16:27 UTC
Hi guys,
Any plan to fix this?
Comment 7 Rainer Jung 2023-04-26 10:10:37 UTC
I just added a fix for trunk in 1909429 and plan to suggest it for backport.

The changelog item would be:

mod_status: Remove duplicate keys "BusyWorkers" and "IdleWorkers".
Resolve inconsistency between the previous two occurrences by
counting workers in state SERVER_GRACEFUL no longer as busy,
but instead in a new counter "GracefulWorkers" (or on HTML
view as "workers gracefully restarting"). Also add the graceful
counter as a new column to the existing HTML per process table
for async MPMs.

That should explain, how I resolved it.
Comment 8 Rainer Jung 2023-04-26 10:11:30 UTC
See also:

https://svn.apache.org/viewvc?view=revision&revision=r1909429
Comment 9 Tomas Korbar 2023-07-19 15:20:47 UTC
Hi Rainer,
I think there is a typo.

+                    if (res == SERVER_GRACEFUL)
+                        graceful++;
+                        if (is_async) {
+                            thread_graceful_buffer[i]++;
+                    } else {
+                        busy++;
+                        if (is_async)
                             thread_busy_buffer[i]++;

You indented the first "if (is_async)" as if it was guarded by the "if (res == SERVER_GRACEFUL)" condition but it is not.
Comment 10 Yann Ylavic 2023-07-19 15:28:18 UTC
The typo was fixed in r1909606 already, thanks for reviewing/noticing!
Comment 11 Rainer Jung 2023-08-23 22:54:50 UTC
Proposed for backport to 2.4.x.
Comment 12 Rainer Jung 2023-08-24 10:10:49 UTC
Committed to 2.4.x in r1911892.
Will be part of 2.4.58.