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

SOFAArk module uninstall 报错,无法正常完成清理工作 #1321

Closed
lvjing2 opened this issue May 16, 2024 · 7 comments
Closed

SOFAArk module uninstall 报错,无法正常完成清理工作 #1321

lvjing2 opened this issue May 16, 2024 · 7 comments

Comments

@lvjing2
Copy link

lvjing2 commented May 16, 2024

Describe the bug

模块卸载时,会执行两个步骤:

  1. 执行 applicationContext.close() 操作,这会清理 SOFARuntimeContainer 里的模块 SOFARuntime
  2. 执行 com.alipay.sofa.boot.ark.handler.SofaBizUninstallEventHandler,会执行清理操作,但是由于 SOFARuntime 已经在第一步里被删除了,所以这一步的清理实际上没有完成,而直接报错。
    image

To Reproduce

Steps to reproduce the behavior:

  1. 打开 https://github.com/koupleless/samples/tree/main/sofaboot4-samples/dynamic-stock
  2. 启动基座,并安装模块
  3. 卸载模块
  4. 报错
    image

Expected behavior

无报错,正常卸载模块

Environment:

  • Project Version SOFABoot 4.2
  • Language Version (e.g. Go 1.13): java 12
  • OS version (e.g. uname -a): mac
  • IDE version: 2023.3
@lvjing2 lvjing2 changed the title SOFAArk module can't uninstall, SOFAArk module uninstall 报错,无法正常完成清理工作 May 16, 2024
@CrazyHZM
Copy link
Contributor

@lvjing2 看了一下是因为BizUninstallEventHandler 执行了shutdownContext,这边要执行shutdownContext的原因是什么?

@lvjing2
Copy link
Author

lvjing2 commented May 21, 2024

@CrazyHZM BizUninstallEventHandler 是触发模块 application Context真正执行 close 操作的地方,模块卸载的真正操作就在这里面完成的

@lvjing2
Copy link
Author

lvjing2 commented May 21, 2024

sofaboot 4的基座 + sofaboot 4的模块,就会发生这个问题

@HzjNeverStop
Copy link
Contributor

SOFAArk 模块卸载时是否能只触发 BeforeBizStopEvent,不要主动调用 applicationContext.close() 方法呢,在 com.alipay.sofa.runtime.spi.component.SofaRuntimeManager#shutDownExternally 的后续逻辑中会执行 applicationContext.close()

@CrazyHZM
Copy link
Contributor

@lvjing2 context的生命周期可以交给sofaboot管理,ark可以不关心context是什么阶段销毁的。看看主动执行shutdownContext是有什么特殊场景吗

@lvjing2
Copy link
Author

lvjing2 commented May 23, 2024

sofaark 面向sofaboot 和 springboot等多种框架,如果这样,其他框架的模块就没有自动关闭的能力

@CrazyHZM
Copy link
Contributor

sofaark 面向sofaboot 和 springboot等多种框架,如果这样,其他框架的模块就没有自动关闭的能力

同意,sofaboot这边需要再destroy的时候加强一下生命周期的管理,能够支持application context close时销毁相关对象。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants