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 too many logger fault #722

Merged
merged 1 commit into from
Mar 5, 2024
Merged

fix too many logger fault #722

merged 1 commit into from
Mar 5, 2024

Conversation

Kuri-su
Copy link
Contributor

@Kuri-su Kuri-su commented Jan 29, 2024

在创建大量 Nacos Logger 的场景下面, 会造成 Logger 的 lumberjack.Logger 出现 goroutine 大量没释放

这个 PR 是为了把Logger 做成单例

@CLAassistant
Copy link

CLAassistant commented Jan 29, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@binbin0325 binbin0325 left a comment

Choose a reason for hiding this comment

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

什么场景下会大量创建Logger?

@dimon-cmd
Copy link

什么场景下会大量创建Logger?
我们自己做了一个 类似于 对 nacos 的 gateway 的东西, 然后用这个 gateway 来收束对 Nacos 的连接, 这个 Gateway 上面会频繁的调用 创建和销毁客户端,每个客户端都会初始化一遍log,但是log(lumberjack.Logger 成员函数)没有被释放的操作,频繁的销毁和创建,就会有内存和gorutine泄漏

@binbin0325
Copy link
Member

什么场景下会大量创建Logger?
我们自己做了一个 类似于 对 nacos 的 gateway 的东西, 然后用这个 gateway 来收束对 Nacos 的连接, 这个 Gateway 上面会频繁的调用 创建和销毁客户端,每个客户端都会初始化一遍log,但是log(lumberjack.Logger 成员函数)没有被释放的操作,频繁的销毁和创建,就会有内存和gorutine泄漏

为什么要频繁的创建和销毁客户端,客户端只有一份就好,考虑下使用的方式是否合理

@binbin0325 binbin0325 merged commit 6dd8997 into nacos-group:master Mar 5, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants