Skip to content

[KYUUBI #2503][FOLLOWUP] Catch all exceptions for sessions timeout check task #5727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract class SessionManager(name: String) extends CompositeService(name) {
conf: Map[String, String]): Session

protected def logSessionCountInfo(session: Session, action: String): Unit = {
info(s"${session.user}'s session with" +
info(s"${session.user}'s ${session.getClass.getSimpleName} with" +
s" ${session.handle}${session.name.map("/" + _).getOrElse("")} is $action," +
s" current opening sessions $getOpenSessionCount")
}
Expand Down Expand Up @@ -303,20 +303,21 @@ abstract class SessionManager(name: String) extends CompositeService(name) {

val checkTask = new Runnable {
override def run(): Unit = {
info(s"Checking sessions timeout, current count: $getOpenSessionCount")
val current = System.currentTimeMillis
if (!shutdown) {
for (session <- handleToSession.values().asScala) {
if (session.lastAccessTime + session.sessionIdleTimeoutThreshold <= current &&
session.getNoOperationTime > session.sessionIdleTimeoutThreshold) {
info(s"Closing session ${session.handle.identifier} that has been idle for more" +
s" than ${session.sessionIdleTimeoutThreshold} ms")
try {
try {
if (session.lastAccessTime + session.sessionIdleTimeoutThreshold <= current &&
session.getNoOperationTime > session.sessionIdleTimeoutThreshold) {
info(s"Closing session ${session.handle.identifier} that has been idle for more" +
s" than ${session.sessionIdleTimeoutThreshold} ms")
closeSession(session.handle)
} catch {
case NonFatal(e) => warn(s"Error closing idle session ${session.handle}", e)
} else {
session.closeExpiredOperations()
}
} else {
session.closeExpiredOperations()
} catch {
case NonFatal(e) => warn(s"Error checking session ${session.handle} timeout", e)
}
}
}
Expand Down