vesoft-inc / vesoft-inc/nebula-java

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

Open
#621 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
199
Forks
125
Avg merge
5h 6m
Merged PRs (30d)
3

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in SessionPool.java around lines 414-421 and read how checkSession and updateSessionQueue can run concurrently while checking and releasing connections. Verify the reported SocketException and corrupted request scenario, then confirm that the connection is not released between the session check and ping; add or run focused coverage if the repository provides it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.