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

连接PgSql时,DisableAutomaticPing设置为true,但还是会触发--ping命令,并且连接不断开,导致连接数一直在增加 #7196

Closed
meichuanneiku opened this issue Sep 18, 2024 · 9 comments
Assignees
Labels

Comments

@meichuanneiku
Copy link

meichuanneiku commented Sep 18, 2024

场景:
在使用go-kratos框架中实现一个定时任务,该任务会查询pgsql中的数据,因此会在项目启动时创建pgsql的连接,在连接的配置信息中DisableAutomaticPing设置为true,企图关闭自动ping的功能

问题:
但在运行一段时间(大概1天),发现pg数据库无法连接,就查询数据库的连接状态,发现--ping命令的连接未断开并且数量还一直在增加。之后就尝试修改连接池的数量,不管修改多少,问题仍然存在

使用版本:
go:1.22.4
gorm: 1.25.12

查询数据库连接状态截图:

联想截图_20240918101050 联想截图_20240918101418

示例代码项目:
https://github.com/meichuanneiku/connentgorm.git

@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Sep 18, 2024
Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

@meichuanneiku
Copy link
Author

实现了一个测试demo
https://github.com/meichuanneiku/connentgorm.git

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

@ivila
Copy link
Contributor

ivila commented Sep 19, 2024

@meichuanneiku 你这样提issue的方式是不正确的,你提的demo也应该是gorm就可以复现的问题,而不是给出一个使用复杂的巨型框架的demo代码(并且里面还没有明显的gorm是如何连接的说明)。
你应该给出一个gorm就可复现的demo,这样大家才能快速地帮你找到问题并解决,而不是先浪费时间去找你的一大堆信息里面有哪些是有用的(更别说你的demo里面还引入了一大堆额外变量)

Copy link

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

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

No branches or pull requests

3 participants