Skip to content

Optimize CLI and console annotation subsystems - #27116

Open
Piyush0049 wants to merge 2 commits into
jenkinsci:masterfrom
Piyush0049:optimize-cli-console
Open

Optimize CLI and console annotation subsystems#27116
Piyush0049 wants to merge 2 commits into
jenkinsci:masterfrom
Piyush0049:optimize-cli-console

Conversation

@Piyush0049

@Piyush0049 Piyush0049 commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

Optimize CLI and console annotation subsystems

This pull request introduces targeted performance optimizations and concurrency fixes to the CLI and console annotation subsystems.

Key improvements:

  • Resolves race conditions in WebSocketSession by introducing volatile visibility and strict null guards.
  • Caches Locales in ServerSideImpl using a static ConcurrentHashMap to eliminate GC churn and speed up CLI boot times.
  • Prevents Mojibake character corruption via explicit Charset propagation in ConsoleAnnotationOutputStream.

Testing done

Automated testing was performed locally via Maven to ensure strict backwards compatibility and structural soundness. The following targeted tests were executed and passed with zero failures:

  • CLIActionTest
  • Security3630Test

If maintainers require further test coverage or specific structural adjustments, please feel free to convert this PR into a draft while those additional items are resolved.

Screenshots (UI changes only)

Before

N/A

After

N/A

Proposed changelog entries

  • Prevent NullPointerExceptions in WebSocket CLI sessions due to thread race conditions.
  • Improve CLI connection performance by caching available Locales.
  • Prevent character corruption in console annotations by explicitly honoring stream Charsets.

Proposed changelog category

/label bug, rfe

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

@jenkinsci/core-pr-reviewers

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.

- Resolves race conditions in WebSocketSession
- Caches Locales in ServerSideImpl to eliminate GC churn
- Prevents Mojibake via explicit Charset in ConsoleAnnotationOutputStream
- Reduces intermediate allocations in Base64 decoding for AnnotatedLargeText
Copilot AI review requested due to automatic review settings July 19, 2026 07:16
@comment-ops-bot comment-ops-bot Bot added bug For changelog: Minor bug. Will be listed after features rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted labels Jul 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread core/src/main/java/hudson/console/AnnotatedLargeText.java Outdated
Copilot AI review requested due to automatic review settings July 19, 2026 14:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread core/src/main/java/hudson/cli/CLIAction.java
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 rfe For changelog: Minor enhancement. use `major-rfe` for changes to be highlighted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants