[Bug] When some users submit kyuubi tasks,like a query sql, "Invalid OperationHandle" appears
- 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
I connect to kyuubi via beeline. When I use a specific user to perform a normal select operation, an "Invalid OperationHandle" error will appear, but it can be submitted normally using other users.
### Affects Version(s)
1.8.1
### Kyuubi Server Log Output
```logtalk
2025-01-07 13:46:44.955 ERROR KyuubiTBinaryFrontendHandler-Pool: Thread-143 org.apache.kyuubi.server.KyuubiTBinaryFrontendService: Error closing operation:
org.apache.kyuubi.KyuubiSQLException: Invalid OperationHandle [12c8a2d4-852e-4ddd-b0a0-1215a3bc4c1e]
at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:70)
at org.apache.kyuubi.operation.OperationManager.getOperation(OperationManager.scala:107)
at org.apache.kyuubi.service.AbstractBackendService.closeOperation(AbstractBackendService.scala:192)
at org.apache.kyuubi.server.KyuubiServer$$anon$1.org$apache$kyuubi$server$BackendServiceMetric$$super$closeOperation(KyuubiServer.scala:171)
at org.apache.kyuubi.server.BackendServiceMetric.$anonfun$closeOperation$1(BackendServiceMetric.scala:171)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at org.apache.kyuubi.metrics.MetricsSystem$.timerTracing(MetricsSystem.scala:112)
at org.apache.kyuubi.server.BackendServiceMetric.closeOperation(BackendServiceMetric.scala:171)
at org.apache.kyuubi.server.BackendServiceMetric.closeOperation$(BackendServiceMetric.scala:169)
at org.apache.kyuubi.server.KyuubiServer$$anon$1.closeOperation(KyuubiServer.scala:171)
at org.apache.kyuubi.service.TFrontendService.CloseOperation(TFrontendService.scala:498)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$CloseOperation.getResult(TCLIService.java:1797)
at org.apache.hive.service.rpc.thrift.TCLIService$Processor$CloseOperation.getResult(TCLIService.java:1782)
at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:39)
at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:39)
at org.apache.kyuubi.service.authentication.TSetIpAddressProcessor.process(TSetIpAddressProcessor.scala:36)
at org.apache.thrift.server.TThreadPoolServer$WorkerProcess.run(TThreadPoolServer.java:286)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
```
### 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 OperationManager.scala at getOperation and AbstractBackendService.scala at closeOperation, following the stack trace through TFrontendService.scala. Reproduce the user-specific Beeline SELECT failure and compare it with a user that succeeds; the issue is done when the cause of the invalid handle is identified and the affected operation can be closed normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala, sql
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100