Skip to content
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

[KYUUBI #6843] [FOLLOWUP] Fix 'query-timeout-thread' thread leak #6873

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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 @@ -16,7 +16,9 @@
*/
package org.apache.kyuubi.engine.chat.operation

import org.apache.kyuubi.Logging
import java.util.concurrent.RejectedExecutionException

import org.apache.kyuubi.{KyuubiSQLException, Logging}
import org.apache.kyuubi.engine.chat.provider.ChatProvider
import org.apache.kyuubi.operation.{ArrayFetchIterator, OperationState}
import org.apache.kyuubi.operation.log.OperationLog
Expand All @@ -41,9 +43,19 @@ class ExecuteStatement(
executeStatement()
}
}
val chatSessionManager = session.sessionManager
val backgroundHandle = chatSessionManager.submitBackgroundOperation(asyncOperation)
setBackgroundHandle(backgroundHandle)
try {
val chatSessionManager = session.sessionManager
val backgroundHandle = chatSessionManager.submitBackgroundOperation(asyncOperation)
setBackgroundHandle(backgroundHandle)
} catch {
case rejected: RejectedExecutionException =>
setState(OperationState.ERROR)
val ke =
KyuubiSQLException("Error submitting query in background, query rejected", rejected)
setOperationException(ke)
shutdownTimeoutMonitor()
throw ke
}
} else {
executeStatement()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.kyuubi.engine.jdbc.operation

import java.sql.{Connection, Statement, Types}
import java.util.concurrent.RejectedExecutionException

import org.apache.kyuubi.{KyuubiSQLException, Logging}
import org.apache.kyuubi.engine.jdbc.schema.{Column, Row, Schema}
Expand Down Expand Up @@ -50,9 +51,19 @@ class ExecuteStatement(
executeStatement()
}
}
val jdbcSessionManager = session.sessionManager
val backgroundHandle = jdbcSessionManager.submitBackgroundOperation(asyncOperation)
setBackgroundHandle(backgroundHandle)
try {
val jdbcSessionManager = session.sessionManager
val backgroundHandle = jdbcSessionManager.submitBackgroundOperation(asyncOperation)
setBackgroundHandle(backgroundHandle)
} catch {
case rejected: RejectedExecutionException =>
setState(OperationState.ERROR)
val ke =
KyuubiSQLException("Error submitting query in background, query rejected", rejected)
setOperationException(ke)
shutdownTimeoutMonitor()
throw ke
}
} else {
executeStatement()
}
Expand Down
Loading