Repository navigation
[codex] Make version checks asynchronous and optional - #3286
Open
hengyunabc wants to merge 2 commits into
Open
hengyunabc wants to merge 2 commits into
hengyunabc wants to merge 2 commits into
Conversation
hengyunabc
marked this pull request as ready for review
November 4, 2026 02:12
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved issues can cause redirect pages to be logged as version data, cross-test interference through the global proxy selector, and worker/classloader retention after shutdown.
3 open issues
What changed in this PR
Moves Arthas’s target-JVM version check out of welcome-message rendering into an optional background task, avoiding network waits during startup and client connections.
Changes:
- Add the default-enabled
arthas.checkLatestVersionsetting. - Run a one-shot daemon worker with HTTP resource cleanup and shutdown interruption.
- Add regression tests and bilingual documentation covering configuration and target-JVM limitations.
| File | Description |
|---|---|
site/docs/en/doc/arthas-properties.md |
Document configuration options and limitations in English. |
site/docs/doc/arthas-properties.md |
Document configuration options and limitations in Chinese. |
core/src/test/java/com/taobao/arthas/core/util/ArthasBannerTest.java |
Test network-free banners, asynchronous checks, and resource cleanup. |
core/src/test/java/com/taobao/arthas/core/server/ArthasBootstrapTest.java |
Test that disabling checks prevents worker creation. |
core/src/test/java/com/taobao/arthas/core/config/ConfigureTest.java |
Test defaults, binding, and configuration serialization. |
core/src/main/java/com/taobao/arthas/core/util/ArthasBanner.java |
Replace banner-triggered checks with an asynchronous worker. |
core/src/main/java/com/taobao/arthas/core/server/ArthasBootstrap.java |
Start the configured check and interrupt its worker during teardown. |
core/src/main/java/com/taobao/arthas/core/config/Configure.java |
Add the version-check configuration property. |
core/src/main/java/arthas.properties |
Add a commented example for disabling version checks. |
Review effort: Max
Comment on lines
+173
to
+175
| // Use the JDK's bounded redirect handling instead of recursive requests. | ||
| connection.setInstanceFollowRedirects(true); | ||
| try (InputStream inputStream = connection.getInputStream()) { |
| // Use the JDK's bounded redirect handling instead of recursive requests. | ||
| connection.setInstanceFollowRedirects(true); | ||
| try (InputStream inputStream = connection.getInputStream()) { | ||
| return com.taobao.arthas.common.IOUtils.toString(inputStream).trim(); |
Comment on lines
+43
to
+46
| if ("arthas.aliyun.com".equals(uri.getHost())) { | ||
| requests.incrementAndGet(); | ||
| // Fail before DNS or network I/O, even when testing the old implementation. | ||
| throw new IllegalStateException("Unexpected version check while rendering the welcome message"); |
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.

Arthas checks for updates while rendering the welcome message and waits up to two seconds for each check. This can delay startup and tunnel client connections, and there is no way to disable the request inside the target JVM.
Move the check to the end of bootstrap initialization and run it once on a dedicated daemon thread without waiting. A successful check logs the version; a failed check logs at debug level. Neither path schedules another attempt. Accept only a final HTTP status of 200, so unfollowed redirects and other non-200 responses cannot be logged as version data. Check interruption between response reads, close the response stream and connection, and interrupt the worker when Arthas stops.
Add
arthas.checkLatestVersion, enabled by default. Setting it tofalseprevents creation of the worker and the version-check request, including its DNS lookup. Document configuration, response handling, and cancellation limits in Chinese and English.The background thread still runs inside the target JVM. This change does not fix native DNS crashes or guarantee termination of a stuck native call. Connection and read timeouts are not an overall deadline; affected environments must disable the check.
arthas-bootdownload/version-selection requests are unchanged.Run the welcome-message network interception test in an isolated JVM so its global proxy selector cannot intercept workers started by other tests.
Fixes #2973.
Related to #3021, including #3021 (comment).
Validation:
./mvnw -pl core -am test -Dtest=ArthasBannerTest,ConfigureTest,ArthasBootstrapTest,EnhancerLineTest -Dsurefire.failIfNoSpecifiedTests=false— 19 tests passed.npm --prefix site run docs:build— passed.git diff --check— passed.