Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix "Zeno’s paradox" like logic of the progress calculation.#26235

Merged
MarkEWaite merged 5 commits into
jenkinsci:masterfrom
dukhlov:progressive-rendering-fix
Feb 8, 2026
Merged

Fix "Zeno’s paradox" like logic of the progress calculation.#26235
MarkEWaite merged 5 commits into
jenkinsci:masterfrom
dukhlov:progressive-rendering-fix

Conversation

@dukhlov
Copy link
Copy Markdown
Contributor

@dukhlov dukhlov commented Jan 31, 2026

The previous progress calculation logic is not infinite.

The following test demonstrates that after 730 iterations, the progress reaches 100%:

class Main {
    public static void main(String[] args) {
        int iterations = 0;
        double MAX_LIKELY_RUNS = 20;
        double decay = 1;
        while (1 - decay != 1.0) {
            decay *= 1 - 1 / MAX_LIKELY_RUNS;
            iterations++;
        }
        System.out.println("Iterations: " + iterations);
    }
}

Output:
Iterations: 730

As a result, the UI receives status: done and stops fetching additional results, while the backend continues iterating through all remaining builds (during 15 second timeout)

Testing done

Manual testing on local env done

Before

After

Proposed changelog entries

  • fix progressive rendering progress calculation

Proposed changelog category

/label bug

Proposed upgrade guidelines

N/A

Submitter checklist

  • The issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • UI changes do not introduce regressions when enforcing the current default rules of Content Security Policy Plugin. In particular, new or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@jglick

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, be a Bug or Improvement, and either the issue or pull request must be labeled as lts-candidate to be considered.

@comment-ops-bot comment-ops-bot Bot added the bug For changelog: Minor bug. Will be listed after features label Jan 31, 2026
@dukhlov dukhlov force-pushed the progressive-rendering-fix branch 6 times, most recently from a4a4b81 to adf7a98 Compare February 1, 2026 09:21
@dukhlov dukhlov force-pushed the progressive-rendering-fix branch from adf7a98 to 6998f5f Compare February 1, 2026 15:58
@dukhlov
Copy link
Copy Markdown
Contributor Author

dukhlov commented Feb 2, 2026

Previously, the result set was limited to a single 'news' request. This fix allows it to return all records, but on my laptop (Chrome), the UI becomes unusable once the table exceeds 10,000 rows. It seems reasonable to cap the result set at 10,000 records until the current UI implementation can handle larger datasets. What do you think?

@timja
Copy link
Copy Markdown
Member

timja commented Feb 2, 2026

Previously, the result set was limited to a single 'news' request. This fix allows it to return all records, but on my laptop (Chrome), the UI becomes unusable once the table exceeds 10,000 rows. It seems reasonable to cap the result set at 10,000 records until the current UI implementation can handle larger datasets. What do you think?

You got a screenshot or video to demonstrate what you mean?

Copy link
Copy Markdown
Member

@jglick jglick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should work better indeed, based on a numeric evaluation up to 10_000 iterations: gets up to ~99.90009% rather than quickly hitting the double overflow after 99.99999999999999%.

Comment on lines 46 to 47
* The first increment will be sized as if this many runs will be in the total,
* but then like Zeno’s paradox we will never seem to finish until we actually do.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From #1046 apparently. I have little recollection of this.

@jglick
Copy link
Copy Markdown
Member

jglick commented Feb 2, 2026

cap the result set at 10,000 records until the current UI implementation can handle larger datasets

Well the server would be churning through thousands of little XML files on disk by that point.

Ideally all UI elements related to lazy loading would be redesigned to use the “infinite scrollbar” trick so the server does not load records unless and until the user expresses an interest in viewing them.

@dukhlov
Copy link
Copy Markdown
Contributor Author

dukhlov commented Feb 2, 2026

cap the result set at 10,000 records until the current UI implementation can handle larger datasets

Well the server would be churning through thousands of little XML files on disk by that point.

Ideally all UI elements related to lazy loading would be redesigned to use the “infinite scrollbar” trick so the server does not load records unless and until the user expresses an interest in viewing them.

Agree. The question is: do we need a limit for the existing UI? Before this fix, the dataset was limited by an incorrect progress calculation. I received between 1k and 10k records on the build history page, depending on network latency, server load, and other random factors.
After this fix, the server will iterate over all builds and return them to the UI to be displayed. On my Jenkins cluster, I have about 2,000,000 builds. I am afraid that the build history will become useless on such installations.

@dukhlov
Copy link
Copy Markdown
Contributor Author

dukhlov commented Feb 2, 2026

Previously, the result set was limited to a single 'news' request. This fix allows it to return all records, but on my laptop (Chrome), the UI becomes unusable once the table exceeds 10,000 rows. It seems reasonable to cap the result set at 10,000 records until the current UI implementation can handle larger datasets. What do you think?

You got a screenshot or video to demonstrate what you mean?

will do tomorrow

@jglick
Copy link
Copy Markdown
Member

jglick commented Feb 2, 2026

Feel free to impose some sort of deliberate cap on the number of results returned.

@dukhlov
Copy link
Copy Markdown
Contributor Author

dukhlov commented Feb 3, 2026

* but then like Zeno’s paradox we will never seem to finish until we actually do.
*/
private static final double MAX_LIKELY_RUNS = 20;
private static final int LIMIT = SystemProperties.getInteger(RunListProgressiveRendering.class.getName() + ".limit", Integer.MAX_VALUE);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put some sort of sensible limit here instead of max value? As Jesse said ideally the frontend would only request more builds if the user is actually scrolling.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm planning to set a 10,000 request limit on my Jenkins installation, but I'm not confident enough to say that this will be a reasonable default limit. So I leave this choice to you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

500 or 1000 is probably fine, I would expect the browser to probably start struggling after that.

@timja timja requested a review from jglick February 3, 2026 16:18
Comment on lines +63 to +65
Iterator<? extends Run<?, ?>> iter = builds.iterator();
while (iter.hasNext() && !canceled() && processed < LIMIT) {
Run<?, ?> build = iter.next();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit more legible IMO as the for loop it was before.

Copy link
Copy Markdown
Contributor

@MarkEWaite MarkEWaite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback.

/label ready-for-merge

@comment-ops-bot comment-ops-bot Bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Feb 7, 2026
@MarkEWaite MarkEWaite merged commit 68f5885 into jenkinsci:master Feb 8, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug For changelog: Minor bug. Will be listed after features ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants