Skip to content

sessionPool的checkSession和updateSessionQueue并发执行导致报错 #621

@gnixgnohuh

Description

@gnixgnohuh

bug描述
nebula-sdk版本3.8.4,jdk版本1.8

客户端报错

--
(SessionPool.java:421) c.v.n.c.g.SessionPool - session ping error, java.net.SocketException: Socket closed, remove current session.

Graphd日志报错
E20250911 12:34:14.451815 1034223 HeaderServerChannel.cpp:127] Received corrupted request from client: (transport apache::thrift::PreReceivedDataAsyncTransportWrapper,
address ::ffff:xx.xx.xx.xx, port 49343). Corrupted payload in header message. In message header, protoId: 2, clientType: 0. First few bytes of payload: \026\252\254\2
33\325\315\237\237\006\000

原因定位
猜测是客户端主动关闭了连接

checkSession默认10分钟执行一次yield 1探活
updateSessionQueue默认1小时执行一次,回收状态为空闲的连接
这两个任务并发执行

Image 这里仅判断连接是否空闲,就直接release掉了连接

Image 此时checkSession的代码刚好执行,414行返回true,417行执行时,连接此时已经关闭了,服务端收到了一半的包,所以解析报错

修改方式

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions