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] The last packet successfully received from the server was 38,307,062 milliseconds ago. The last packet sent successfully to the server was 38,307,063 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. #6295

Open
Ren842487118 opened this issue Dec 19, 2024 · 0 comments

Comments

@Ren842487118
Copy link

Database Type

Mysql

Database Version

8.0.24

Druid Version

1.2.20

JDK Version

17

Error SQL

随机出现 某个查询出现

Testcase Code

datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
url: jdbc:mysql://127.0.0.1:3306/chihuodao?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai&useSSL=false&allowMultiQueries=true&allowPublicKeyRetrieval=true
username: chihuodao
password: 123456789
driver-class-name: com.mysql.cj.jdbc.Driver
# 最大连接数
max-active: 50
# 最小连接数
min-idle: 10
# 初始大小
initial-size: 5
# 连接等待超时时间
max-wait: 30000
# 多久检测一次需要关闭的空闲连接 单位毫秒
time-between-eviction-runs-millis: 60000
# 一个连接在池中最小生存的时间,单位是毫秒
min-evictable-idle-time-millis: 600000
# 一个连接在池中最大生存的时间,单位是毫秒
max-evictable-idle-time-millis: 900000
# 检测连接是否有效的sql
validation-query: select 1
# 建议配置为true,不影响性能,并且保证安全性。申请连接的时候检测,如果空闲时间大于timeBetweenEvictionRunsMillis,执行validationQuery检测连接是否有效。
test-while-idle: true
# 申请连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能,其实一般情况下都可以开启,只有性能要求极其高且连接使用很频繁的情况下才有必要禁用。
test-on-borrow: true
# 归还连接时执行validationQuery检测连接是否有效,做了这个配置会降低性能,这个一般不需要开启。
test-on-return: false
# 连接池中的minIdle数量以内的连接,空闲时间超过minEvictableIdleTimeMillis,则会执行keepAlive操作。实际项目中建议配置成true
keep-alive: true
# 强制回收物理连接的最大超时时长,大于0的情况下才生效,当物理创建之后存活的时长超过该值时,该连接会强制销毁,便于重新创建新连接,建议可以配置成7小时的毫秒值,比如25200000,这样可以规避MySQL的8小时连接断开问题
phy-timeout-millis: 25200000

Stacktrace Info

No response

Error Info

No response

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

No branches or pull requests

1 participant