yadavay-amzn commented on code in PR #55720: URL: https://github.com/apache/spark/pull/55720#discussion_r3268315219
########## sql/connect/client/jvm/src/test/scala/org/apache/spark/sql/application/AmmoniteReplE2ESuite.scala: ########## @@ -0,0 +1,72 @@ +/* + * 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. + */ +package org.apache.spark.sql.application + +import java.util.concurrent.TimeUnit + +import scala.collection.mutable.ArrayBuffer +import scala.sys.process.BasicIO + +import org.apache.spark.sql.connect.test.{ConnectFunSuite, RemoteSparkSession} +import org.apache.spark.tags.AmmoniteTest + +@AmmoniteTest +class AmmoniteReplE2ESuite extends ConnectFunSuite with RemoteSparkSession { + + private def runSparkShell(): (Int, String, String) = { + val sparkHome = sys.props.getOrElse( + "spark.test.home", + sys.env.getOrElse("SPARK_HOME", fail("spark.test.home or SPARK_HOME not set"))) + val command = Seq(s"$sparkHome/bin/spark-shell", "--remote", s"sc://localhost:$serverPort") + + val process = new ProcessBuilder(command: _*).start() + // Close stdin immediately so shell exits on EOF + process.getOutputStream.close() + + val stdout = new ArrayBuffer[String]() + val stderr = new ArrayBuffer[String]() + val stdoutThread = new Thread() { + setDaemon(true) + override def run(): Unit = BasicIO.processFully(stdout += _)(process.getInputStream) + } + val stderrThread = new Thread() { + setDaemon(true) + override def run(): Unit = BasicIO.processFully(stderr += _)(process.getErrorStream) + } + stdoutThread.start() + stderrThread.start() + + val exited = process.waitFor(60, TimeUnit.SECONDS) + if (!exited) { + process.destroyForcibly() + fail("spark-shell did not exit within 60 seconds") + } + stdoutThread.join(10000) + stderrThread.join(10000) + (process.exitValue(), stdout.mkString("\n"), stderr.mkString("\n")) + } + + test("SPARK-56448: restarting spark-shell --remote does not throw NPE") { Review Comment: @dongjoon-hyun Thanks for taking a look. We haven't seen this specific Arrow/Netty failure in our CI runs. The CI failures we saw were always the `OracleIntegrationSuite` Docker test. The test launches spark-shell --remote as a subprocess, so it's sensitive to the JDK environment the CI runner uses. Would it help to add a retry or mark this test as flaky? I'll also investigate the Arrow/Netty root cause by running the test locally to see if the CI flaky behavior is reproducible locally. -- 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]
