This is an automated email from the ASF dual-hosted git repository.
chengpan pushed a commit to branch branch-1.10
in repository https://gitbox.apache.org/repos/asf/kyuubi.git
The following commit(s) were added to refs/heads/branch-1.10 by this push:
new c3c53f2ff4 [KYUUBI #7035] Close the operation by operation manager to
prevent operation leak
c3c53f2ff4 is described below
commit c3c53f2ff4dfecfae4801cf9d8b894ef42648eec
Author: Wang, Fei <[email protected]>
AuthorDate: Thu Apr 24 14:14:07 2025 +0800
[KYUUBI #7035] Close the operation by operation manager to prevent
operation leak
### Why are the changes needed?
To fix the operation leak if the session init timeout.
1. the operationHandle has not been added into session `opHandleSet`
(super.runOperation).
2. The `operation.close()` only close the operation, but it does not remove
it from `handleToOperation` map.
3. the session close would not remove the opHandle from `handleToOperation`
as it has not been added into session `opHandleSet`
So here we can resolve the operation leak by invoking
`operationManager.closeOperation` to remove the operation handle and close
session.
https://github.com/apache/kyuubi/blob/cc68cb4c852dccd920ba53a4d853aa407ff83faa/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala#L235-L246
https://github.com/apache/kyuubi/blob/cc68cb4c852dccd920ba53a4d853aa407ff83faa/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala#L100-L103
https://github.com/apache/kyuubi/blob/cc68cb4c852dccd920ba53a4d853aa407ff83faa/kyuubi-common/src/main/scala/org/apache/kyuubi/operation/OperationManager.scala#L127-L130
https://github.com/apache/kyuubi/blob/cc68cb4c852dccd920ba53a4d853aa407ff83faa/kyuubi-common/src/main/scala/org/apache/kyuubi/session/AbstractSession.scala#L89-L92
FYI: the operation was added into `handleToOperation` during new operation.
https://github.com/apache/kyuubi/blob/cc68cb4c852dccd920ba53a4d853aa407ff83faa/kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperationManager.scala#L56-L64
### How was this patch tested?
Minor change.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #7035 from turboFei/remove_op.
Closes #7035
3c376833a [Wang, Fei] close by op mgr
Authored-by: Wang, Fei <[email protected]>
Signed-off-by: Cheng Pan <[email protected]>
(cherry picked from commit ba854d3c99044835ce1702420c27a78e466ee4dd)
Signed-off-by: Cheng Pan <[email protected]>
---
.../src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
index 519e7881b4..0336f67862 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
@@ -238,7 +238,7 @@ class KyuubiSessionImpl(
waitForEngineLaunched()
} catch {
case t: Throwable =>
- operation.close()
+ sessionManager.operationManager.closeOperation(operation.getHandle)
throw t
}
sessionEvent.totalOperations += 1