This repository was archived by the owner on Feb 9, 2026. It is now read-only.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Multilogin使用MySQL数据库时,会使用HikariCP管理连接,而HikariCP的默认参数并不适应所有网络环境。
例如在NAT或者其他防火墙严格的网络环境中,MySQL的TCP长连接撑不到HikariCP的默认30分钟生命周期,两分钟进行一次的保活也没能凑效。我进行过测试了,断联与Multilogin或HikariCP无关,就简单做一个长连接,10分钟才维护一次,在严格的NAT环境,20分钟的时候再检查就已经断了。
具体表现为,Velocity闲置一段时间之后,玩家登录服务器,客户端会卡在“通讯加密中”,服务端的连接池会连续报错数据库连接失效,直到连接超时。
从开发的角度讲,触发的逻辑大概是这样:
不同网络环境的差异过于黑箱,但在我的测试中,能确认修改HikariCP的参数,对连接池的可用率是有立竿见影的改善的。
另外据我所了解,仍有相当量服务器工作在NAT环境下(高防机房非独立IP,或者家里云),且额外在localhost部署一个MySQL实例既没必要也不好管理。
所以我做了这个修改,把连接池的keepaliveTime maxLifetime validationTimeout这几个设定开放出来了,这对解决远程MySQL连接问题会有改善,默认值遵循了原本的设定