mridulm commented on code in PR #45327: URL: https://github.com/apache/spark/pull/45327#discussion_r1507995571
########## sql/core/src/test/scala/org/apache/spark/sql/JoinSuite.scala: ########## @@ -1737,3 +1738,34 @@ class JoinSuite extends QueryTest with SharedSparkSession with AdaptiveSparkPlan } } } + +class ThreadLeakInSortMergeJoinSuite + extends QueryTest + with SharedSparkSession + with AdaptiveSparkPlanHelper { + + setupTestData() + override protected def createSparkSession: TestSparkSession = { + SparkSession.cleanupAnyExistingSession() + new TestSparkSession( + sparkConf.set(SHUFFLE_SPILL_NUM_ELEMENTS_FORCE_SPILL_THRESHOLD, 20)) + } + + test("SPARK-47146: thread leak when doing SortMergeJoin (with spill)") { + + withSQLConf( + SQLConf.AUTO_BROADCASTJOIN_THRESHOLD.key -> "1") { + + assertSpilled(sparkContext, "inner join") { + sql("SELECT * FROM testData JOIN testData2 ON key = a").collect() + System.gc() + } + + val readAheadThread = Thread.getAllStackTraces.keySet().asScala + .find { + _.getName.startsWith("read-ahead") + } + assert(readAheadThread.isEmpty) Review Comment: I was referring [to this PR](https://github.com/apache/spark/pull/45052#discussion_r1501924992) @dongjoon-hyun - the RC for that was some other previous test task interfering the the current (due to delays in killing tasks). -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org