Lealone icon indicating copy to clipboard operation
Lealone copied to clipboard

Server session not found

Open beijingcn opened this issue 2 years ago • 1 comments

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

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

beijingcn avatar Sep 23 '22 02:09 beijingcn

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 avatar Sep 23 '22 02:09 codefollower

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

codefollower avatar Sep 25 '22 01:09 codefollower