Repository navigation
Conversation
Automation signalsActivity patterns show signs of automation. Evidence
Last 5 PRs:
This is an automated analysis by AgentScan |
rm-you
force-pushed
the
fix/worker-stats-retention
branch
from
November 12, 2026 05:01
19bdea9 to
42a3e4f
Compare
This was referenced Nov 12, 2026
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
rm-you
force-pushed
the
fix/worker-stats-retention
branch
from
November 12, 2026 07:02
42a3e4f to
c707925
Compare
Documentation build overview
4 files changed± genindex/index.html± history/index.html± pkg/cheroot.server/index.html± pkg/cheroot.test.test_server/index.html |
rm-you
marked this pull request as ready for review
November 12, 2026 07:44
rm-you
force-pushed
the
fix/worker-stats-retention
branch
from
November 12, 2026 08:35
c707925 to
4137d51
Compare
rm-you
added a commit
to rm-you/cheroot
that referenced
this pull request
Nov 12, 2026
stop() queues a shutdown request for every thread in its list. A thread that shrink() had already asked to shut down takes only one of its two requests, so the other stayed in the queue. So did the request for a worker that stops its own pool on an interrupt, such as a KeyboardInterrupt from the application, since that worker exits without taking one. The next start() lost its new threads to those requests and waited for them forever. stop() also kept the pending shutdowns counted, so a restarted pool reported none of its threads idle. stop() still queues a request for every thread, so that no thread is left waiting for one, whatever shrink() has counted. Once it has joined the threads, it drops the requests that are left, and forgets the pending shutdowns. It keeps one for each thread that still runs and takes one later: a worker that stops its own pool while it handles a connection, and a thread whose join was interrupted, such as by a second Ctrl-C. The connections in the queue stay, in order. The tests' _make_wsgi_server() helper is a copy of the one that cherrypy#881 adds, at the same place, so only one copy remains once both have merged. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
rm-you
force-pushed
the
fix/worker-stats-retention
branch
3 times, most recently
from
November 13, 2026 00:41
947b8ad to
f948ed4
Compare
Every HTTPServer registered its statistics in the process-wide logging.statistics when it was constructed, and nothing removed them. Their callbacks hold the server, so every server ever built stayed alive with its gateway: stopped ones, ones whose prepare() failed to bind, and ones that never started. A server is now registered only while it serves, from prepare() to stop(), and clear_stats() replaces its entry while it serves. One lock covers the ready flag together with each registry update, so a clear_stats() or prepare() racing a stop() cannot register a server that has stopped. stop() holds it only for those two steps, not while it joins the workers. The docs now load pytest's intersphinx inventory: the new tests' annotations name pytest's fixture classes, which the API pages link. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
Every worker thread left its record in its server's Worker Threads statistics when it exited. The record's callbacks hold the thread, so a pool that grows and shrinks again kept every thread it ever started. A worker now removes its record when it exits, and the server keeps the six totals that it adds up from the records: requests, bytes read and written, work time, and both throughputs, which remain the sum of each worker's rate. The server adds and removes records and adds up its totals under one lock, so a removed record counts exactly once, and clear_stats() replaces the statistics and resets the totals together under it. It calls nothing else in a record, so other fields that an application adds to it do not matter. The worker removes its record from the mapping it joined, under the name it had then, so a renamed thread still removes its record. A record that joined statistics cleared since then adds nothing to the new totals. A server that replaces clear_stats() keeps getting records in its own Worker Threads mapping, and losing them when workers exit. The tests define a _wait_until() helper after the module's markers. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
rm-you
force-pushed
the
fix/worker-stats-retention
branch
from
November 13, 2026 01:23
f948ed4 to
cd48dc8
Compare
A server added its retired workers' counts to whichever statistics were read, from the totals of its latest reset. Statistics that a caller kept across clear_stats() then lost the counts of the workers that had retired, and took on those of the next run's, and a worker that retired after the reset added its counts to neither. Each reset now has totals of its own, which its counters read. A worker keeps the records and the totals of the statistics that it joined, and adds its counts to those when it retires. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
The server took its throughput from its workers' own Read Throughput and Write Throughput fields, live and as they retired, where it used to divide each worker's bytes by its work time. A record whose rate field was replaced, made a plain number, or removed then changed the server's figure, or made reading it, and the worker's retirement, raise, with only some of that worker's counts added. The server divides each worker's bytes by its work time again, for live and retiring workers alike, and works out all of a retiring worker's counts before it adds any. Assisted-By: Anthropic Claude Opus 5.5 Signed-off-by: Adam Harwell <flux.adam@gmail.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is the second PR of the statistics stack: #858 → #881. It contains #858's commit too, until that merges. The thread pool fixes are a separate stack: #859 → #882.
This PR's own changes: rm-you/cheroot@557ee9e...20c666b
What kind of change does this PR introduce?
What do these changes do?
Every worker thread left its record in its server's
Worker Threadsstatistics when it exited. The record's callbacks hold the thread, so a pool that grows and shrinks again kept every thread it ever started.A worker now removes its record when it exits, and the server keeps the six totals it adds up from the records (requests, bytes read and written, work time, and both throughputs).
Worker Threadsstays a plain dict, so reporters such as CherryPy's stats page show it as before. The server adds and removes records, and adds up its totals, under one lock, so a removed record counts exactly once.clear_stats()starts totals of its own. A worker adds its counts to those of the statistics it joined, so statistics kept across a reset still add up, and none of a later run's work shows in them.clear_stats()does not call the parent's keeps getting records in its ownWorker Threadsmapping, and losing them when workers exit.This was the second half of the earlier #858. It addresses the review comments there about the sentinel and
getattr(), scalar fields,clear_stats()overrides and renamed threads.#859 and #882 also have the tests'
_wait_until()and_make_wsgi_server()helpers, at the same places;_make_wsgi_server()takes narrower types there. The churn test reaps retired workers itself with_clear_dead_threads(), to work around #861, which #859 fixes. Whichever stack merges second needs a small rebase: its test imports and helpers sit next to the other stack's, and the workaround can go then.Are there changes in behavior for the user?
stats['Worker Threads']lists live workers only. The server totals still include the work of workers that have exited.Is it a substantial burden for the maintainers to support this?
No. Two small server methods add and remove a worker's record under the lock from #858, one adds up the totals, and a helper gives a record's part in each total. The tests cover the totals, statistics cleared while workers run and between runs, changed records and rate fields, a server with its own
clear_stats(), and real HTTP worker churn.Related issue number
Fixes #860, with #858.
Checklist
Tip
New to open source contributions? Making a lovely PR is a great read.
and description in grammatically correct, complete sentences
docs/) and inline docstrings reflect the changes(see good commit messages)
(can be done once the PR number is known; alternatively, you can
use a related issue number if one exists)
code of conduct
This change, its tests and this description were written by AI agents on behalf of Adam Harwell (@rm-you): Anthropic Claude Opus 5.5, with parts of earlier revisions of #858 by Codex GPT-6.