Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the problem where extension point might not be obtained when the plugin was started #6006

Merged

Conversation

JohnNiang
Copy link
Member

@JohnNiang JohnNiang commented May 28, 2024

What type of PR is this?

/kind bug
/area plugin
/area core

What this PR does / why we need it:

This PR refactors SpringComponentsFinder to prevent unexpected cleanup, which might lead to not be able to obtain plugin extension when the plugin was started.

The real reason is that entries is initialized by AttachmentReconciler during initialization of some plugins.

Please note the problem cannot be reproduced stably.

Refs:

Which issue(s) this PR fixes:

Fixes #5999

Does this PR introduce a user-facing change?

修复插件启动成功但仍然可能无法获取扩展点导致页面无法访问的问题

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. area/plugin Issues or PRs related to the Plugin Provider area/core Issues or PRs related to the Halo Core labels May 28, 2024
@f2c-ci-robot f2c-ci-robot bot requested review from guqing and LIlGG May 28, 2024 16:14
@JohnNiang JohnNiang added this to the 2.16.0 milestone May 28, 2024
Copy link

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.3% Duplication on New Code

See analysis details on SonarCloud

Copy link

codecov bot commented May 28, 2024

Codecov Report

Attention: Patch coverage is 77.27273% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 56.13%. Comparing base (5fdf6c0) to head (0c49766).
Report is 214 commits behind head on main.

Files Patch % Lines
...va/run/halo/app/plugin/SpringComponentsFinder.java 77.27% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main    #6006      +/-   ##
============================================
- Coverage     56.91%   56.13%   -0.78%     
- Complexity     3319     3513     +194     
============================================
  Files           587      621      +34     
  Lines         18968    20914    +1946     
  Branches       1401     1460      +59     
============================================
+ Hits          10795    11740     +945     
- Misses         7594     8582     +988     
- Partials        579      592      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@guqing
Copy link
Member

guqing commented May 29, 2024

Note That:

此问题应该与这个重构有关 https://github.com/halo-dev/halo/pull/5251/files#diff-a66b8608c4a9c737903ad1182ab8a33a73b2ebfce26352f8205db82be28667bdL284-L291

相关片段

 private void checkExtensionFinderReady(PluginWrapper pluginWrapper) {
    if (extensionFinder instanceof SpringComponentsFinder springComponentsFinder) {
        springComponentsFinder.readPluginStorageToMemory(pluginWrapper);
        return;
    }
    // should never happen
    throw new PluginRuntimeException("Plugin component classes may not loaded yet.");
}
private void removePluginComponentsCache(String pluginId) {
    if (extensionFinder instanceof SpringComponentsFinder springComponentsFinder) {
        springComponentsFinder.removeComponentsStorage(pluginId);
    }
}

Copy link
Member

@guqing guqing left a comment

Choose a reason for hiding this comment

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

/approve

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 29, 2024
Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label May 29, 2024
Copy link

f2c-ci-robot bot commented May 29, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: guqing, ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot merged commit 08ff7e6 into halo-dev:main May 29, 2024
8 checks passed
@JohnNiang JohnNiang deleted the refactor/spring-components-finder branch May 29, 2024 06:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/core Issues or PRs related to the Halo Core area/plugin Issues or PRs related to the Plugin Provider kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2.16.0-rc1升级后打不开主页
3 participants