yadavay-amzn commented on code in PR #55720: URL: https://github.com/apache/spark/pull/55720#discussion_r3268549909
########## 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: Ran the `AmmoniteReplE2ESuite` test 10 times locally on current master (JDK 17) and its passing consistently. So the flakiness seems specific to the CI run. The error (`ExceptionInInitializerError` in Arrow's `DefaultAllocationManagerFactory` / Netty's `PooledByteBufAllocatorL`) looks like a JDK/Arrow memory allocator incompatibility which may be JDK version sensitive. The test itself just launches spark-shell --remote as a subprocess and it doesn't do anything Arrow/Netty-specific. @dongjoon-hyun / @peter-toth Could you share which JDK vendor/version and CI environment produced the failure? Or a link to the CI job if you have it? I can deep dive to figure out the issue and try repro with same setup. -- 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]
