Skip to content

Commit

Permalink
[KYUUBI apache#4267] Show warning if SessionHandle is invalid
Browse files Browse the repository at this point in the history
### _Why are the changes needed?_
If SessionManager tries to close a session, that was previously closed - it throws an error `org.apache.kyuubi.KyuubiSQLException: Invalid SessionHandle` which causes spark session exit with non-zero code.

### _How was this patch tested?_
- [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible

- [ ] Add screenshots for manual tests if appropriate

- [X] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request

Closes apache#4386 from hanna-liashchuk/catch-invalid-sessionhandle.

Closes apache#4267

bf364ba [Hanna Liashchuk] Show warning if SessionHandle is invalid

Authored-by: Hanna Liashchuk <g.liashchuk@temabit.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
  • Loading branch information
hanna-liashchuk authored and pan3793 committed Feb 21, 2023
1 parent 7eac6ea commit 89cc8c1
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ class SparkSQLSessionManager private (name: String, spark: SparkSession)
}
}
}
super.closeSession(sessionHandle)
try {
super.closeSession(sessionHandle)
} catch {
case e: KyuubiSQLException =>
warn(s"Error closing session ${sessionHandle}", e)
}
if (shareLevel == ShareLevel.CONNECTION) {
info("Session stopped due to shared level is Connection.")
stopSession()
Expand Down

0 comments on commit 89cc8c1

Please sign in to comment.