[Bug] Possible socket leak in KyuubiSessionImpl
- Dominant language
- Scala
- Stars
- 2.4k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
### Search before asking
- [X] I have searched in the [issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no similar issues.
### Describe the bug
When openning a session in _KyuubiSessionImpl.open_ , _LaunchEngine_ operation will submit a backgroup task to launch an engine in the cluster, and _KyuubiSessionImpl._client_ will be assigned a value in the future.
Suppose a cluster with limited resources, user A execute a sql via beeline, then launch engine task pending for resource for a long time, at the same time, beeline was killed for some reason. Kyuubi server will close the session, but the launch engine task still running in then backgroud, once needs met and engine start sucessfully, _KyuubiSessionImpl._client_ will be assigned and hold the socket with engine, it will not release befor next gc.
### Affects Version(s)
master
### Kyuubi Server Log Output
_No response_
### Kyuubi Engine Log Output
_No response_
### Kyuubi Server Configurations
_No response_
### Kyuubi Engine Configurations
_No response_
### Additional context
_No response_
### Are you willing to submit PR?
- [X] Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- [ ] No. I cannot submit a PR at this time.
Contributor guide
Research direction
Start with KyuubiSessionImpl.open and trace the LaunchEngine background task through the future assignment of KyuubiSessionImpl.client. Examine how session closure is handled when the task is still waiting for cluster resources. Done means the client socket is not retained after the session closes, including when the engine starts later.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend, distributed-systems, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100