wangzhigang1999 commented on code in PR #7150: URL: https://github.com/apache/kyuubi/pull/7150#discussion_r2591743952
########## docs/extensions/engines/spark/shutdown-watchdog.md: ########## @@ -0,0 +1,89 @@ +<!-- +- Licensed to the Apache Software Foundation (ASF) under one or more +- contributor license agreements. See the NOTICE file distributed with +- this work for additional information regarding copyright ownership. +- The ASF licenses this file to You under the Apache License, Version 2.0 +- (the "License"); you may not use this file except in compliance with +- the License. You may obtain a copy of the License at +- +- http://www.apache.org/licenses/LICENSE-2.0 +- +- Unless required by applicable law or agreed to in writing, software +- distributed under the License is distributed on an "AS IS" BASIS, +- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- See the License for the specific language governing permissions and +- limitations under the License. +--> + +# Shutdown Watchdog Plugin + +The shutdown watchdog prevents zombie Spark SQL engines by monitoring graceful shutdown. +If the driver does not finish within the configured timeout, the plugin produces a JVM thread +dump for diagnostics and forcefully terminates the process to unblock resource reclamation. + +## Build with Apache Maven + +The plugin lives in the module `extensions/spark/kyuubi-spark-shutdown-watchdog` and can be built via: + +```shell +build/mvn clean package -DskipTests \ + -pl extensions/spark/kyuubi-spark-shutdown-watchdog -am +``` + +The module still publishes artifacts with the standard Scala suffix +(`kyuubi-spark-shutdown-watchdog_2.12`, `..._2.13`, etc.) so that it aligns with +the rest of the project. Maven expands `${scala.binary.version}` automatically, +so you can run the command above without worrying about Scala version specifics. +Because the implementation is pure Java, there are no Scala runtime +dependencies—building by module path is enough. + +After the build succeeds the jar is located at: +`./extensions/spark/kyuubi-spark-shutdown-watchdog/target/kyuubi-spark-shutdown-watchdog_${scala.binary.version}-${project.version}.jar` + +## Installing + +Place the jar on the Spark driver classpath, for example by: + +- Copying it to `$SPARK_HOME/jars`, or +- Pointing Spark to it through `spark.jars` + +## Enabling the plugin + +Add the plugin class to `spark.plugins` when launching the Spark SQL engine: + +```properties +spark.plugins=org.apache.spark.kyuubi.shutdown.watchdog.SparkShutdownWatchdogPlugin +``` + +Configure the timeout directly through Spark (see also the general configuration +table in `docs/configuration/settings.md`): + +```properties +spark.kyuubi.shutdown.watchdog.timeout=60000 Review Comment: fixed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
