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

[BUG]CredentialWatcher中的timer不能被关闭 #4631

Closed
onewe opened this issue Jan 6, 2021 · 9 comments · Fixed by #4634
Closed

[BUG]CredentialWatcher中的timer不能被关闭 #4631

onewe opened this issue Jan 6, 2021 · 9 comments · Fixed by #4634

Comments

@onewe
Copy link
Collaborator

onewe commented Jan 6, 2021

问题

  • timer不能被关闭,导致timer线程一直在后台.
  • 在weblogic这种容器中,通过控制台重复部署,会导致classloader不能被释放,相应的class也不能被卸载,会出现长时间的FULL GC,最后metaspace oom
@horizonzy horizonzy added status/more-info-needed kind/enhancement Category issues or prs related to enhancement. and removed status/more-info-needed labels Jan 6, 2021
@horizonzy
Copy link
Collaborator

问题

  • timer不能被关闭,导致timer线程一直在后台.
  • 在weblogic这种容器中,通过控制台重复部署,会导致classloader不能被释放,相应的class也不能被卸载,会出现长时间的FULL GC,最后metaspace oom

I will fix it. Thanks for your report.

@onewe
Copy link
Collaborator Author

onewe commented Jan 6, 2021

@horizonzy 你这个PR还是关不了,这个timer写法有点问题,等哈我顺手再提个

@onewe
Copy link
Collaborator Author

onewe commented Jan 6, 2021

image
这个是线程截图
image
虽然task是取消了,但是timer这个线程还是在后台驻留着

@horizonzy
Copy link
Collaborator

@horizonzy 你这个PR还是关不了,这个timer写法有点问题,等哈我顺手再提个

嗯,了解了。

@horizonzy
Copy link
Collaborator

看看新的提交。

@onewe
Copy link
Collaborator Author

onewe commented Jan 6, 2021

这样可以的,你的速度可真快0.0

@onewe
Copy link
Collaborator Author

onewe commented Jan 6, 2021

要不把timer改成 ScheduledThreadPoolExecutor??

@horizonzy
Copy link
Collaborator

可行。可以单独再提一个PR来进行优化,欢迎贡献哦

KomachiSion pushed a commit that referenced this issue Jan 8, 2021
…4635)

* fix(CredentialWatcher): 使用ScheduledThreadPoolExecutor替代Timer

* enhance(CredentialWatcher): use ExecutorFactory replace ScheduledThreadPoolExecutor.

* enhance(CredentialWatcher): use ExecutorFactory.Managed replace ExecutorFactory.

* enhance(CredentialWatcher): remove Managed
@KomachiSion KomachiSion added kind/refactor kind/code quality and removed kind/enhancement Category issues or prs related to enhancement. labels Jan 8, 2021
@KomachiSion KomachiSion added this to the 1.4.1 milestone Jan 8, 2021
@onewe
Copy link
Collaborator Author

onewe commented Jan 8, 2021

我觉得nacos里面的各种线程池可以集中管理起来,但是在weblogic里面呢,又不能通过hook的方式进行关闭,有点蛋疼。
用weblogic 真蛋疼

KomachiSion pushed a commit that referenced this issue Jan 11, 2021
…#4634)

* free credential instance when serverHttpAgent shutdown.

* free credential instance when namingProxy shutdown.

* unify the code place

* cancel timer when CredentialWatcher stop

* ignore PMD.AvoidUseTimerRule.
wjm0729 added a commit to wjm0729/nacos that referenced this issue Jan 13, 2021
…op-import-v1

* 'develop' of https://github.com/alibaba/nacos:
  naming push service support CSharp client (alibaba#4670)
  remove final
  [ISSUE-alibaba#3880] NamingService Client support pushEmptyProtection. (alibaba#4665)
  [ISSUE-alibaba#4631] Free credential instance when serverHttpAgent shutdown. (alibaba#4634)
  Add CSharp Client
  Just choose one between nacosDomain mode and servers mode.
  upgrade axios version to 0.21.1 (alibaba#4632)
  [ISSUE-alibaba#4631] Remove timer,Use ScheduledThreadPoolExecutor replaced. (alibaba#4635)
  fix: fix jraft response instance (alibaba#4644)
  For alibaba#4291, support remove old raft metadata
  change tokenValidityInSeconds default value
  remove JwtTokenUtils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants