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

After the NamingService shutdown, there are still related threads remaining 停止NamingService后仍然有相关线程残留 #12278

Open
cfdou opened this issue Jun 24, 2024 · 3 comments
Labels
status/wontfix This will not be worked on

Comments

@cfdou
Copy link

cfdou commented Jun 24, 2024

Describe the bug
Use Namingservice to get the instance information, and call shutdown after the use is over, but there are still threads left. I'm not sure if it's a bug or if it's because I'm using it incorrectly
使用Namingservice获取实例信息,使用结束后调用shutdown,但是还有线程残留。我不确定这是不是bug,或者这是因为我的使用方式不正确

Expected behavior
When shutdown is called, all related threads can be terminated
调用shutdown后,所有相关的线程都能结束

Actually behavior
After the shutdown is called, there are still two threads
调用shutdown后,仍然存在两个线程
image

How to Reproduce
Steps to reproduce the behavior:

  1. Create a NamingService using the NamingFactory
  2. Call shutdown to stop the Namingservice
  3. Use visualvm to see what threads are running
Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, "server_addr");
properties.put(PropertyKeyConst.NAMESPACE, "namespace");
NamingService namingService = NamingFactory.createNamingService(properties);
List<Instance> allInstances = namingService.getAllInstances("service_name");
namingService.shutDown();

Desktop (please complete the following information):

  • OS: Ubuntu 20.04.2 LTS
  • Version: nacos-server 2.1.0, nacos-client 1.4.1 nacos-api 1.4.1
  • Module: naming
  • SDK: original
@KomachiSion KomachiSion added the status/wontfix This will not be worked on label Jun 26, 2024
@KomachiSion
Copy link
Collaborator

事件通知机制是共享的,同一个类型的事件线程是共享的, 如果关闭其中一个客户端实例就关闭事件线程,可能影响其他客户端的订阅。

仅有这2~3个线程并不影响。

@cfdou
Copy link
Author

cfdou commented Jun 27, 2024

事件通知机制是共享的,同一个类型的事件线程是共享的, 如果关闭其中一个客户端实例就关闭事件线程,可能影响其他客户端的订阅。

仅有这2~3个线程并不影响。

有办法停止么,还是说只有java应用结束才会停

@chuntaojun
Copy link
Collaborator

建议只有你确保 shutdown 的时候,你所有的 nacos-client 都正常关闭了,才可以调用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants