lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.44k stars 513 forks source link

Server session not found #156

Closed beijingcn closed 1 year ago

beijingcn commented 1 year ago

General error: "java.lang.RuntimeException: Server session not found, maybe closed or timeout. client session id: 1"; SQL statement:

同时只能由一个client链接 多了就报上面错误

codefollower commented 1 year ago

lealone client 默认使用的是共享模式,也就是一个 lealone client 只创建一条 TCP 连接,当调用 jdbc api 创建 java.sql.Connection 时会对应一个 client session,多个 client session 共享一条 TCP 连接,在这条 TCP 连接上传输数据,每个 client session 在数据库里对应一个 server session,如果某个 client session 在默认的15分钟之内没有发起过请求,lealone 就会认为它超时了,然后就自动关闭 server session,回收资源。

关闭 server session 是不会关闭 TCP 连接 的。

codefollower commented 1 year ago

开发阶段可以在 lealone.yaml 配置文件的 protocol_server_engines -> TCP -> parameters 加上 session_timeout: -1