You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/04/19 13:18:58 UTC
[GitHub] [spark] LuciferYang commented on a diff in pull request #36261: [SPARK-38948][TESTS] Fix `DiskRowQueue` leak in `PythonForeachWriterSuite`
LuciferYang commented on code in PR #36261:
URL: https://github.com/apache/spark/pull/36261#discussion_r853063867
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/python/PythonForeachWriterSuite.scala:
##########
@@ -102,11 +102,15 @@ class PythonForeachWriterSuite extends SparkFunSuite with Eventually with Mockit
private val intProj = UnsafeProjection.create(Array[DataType](IntegerType))
private val thread = new Thread() {
override def run(): Unit = {
- while (iterator.hasNext) {
- outputBuffer.synchronized {
- outputBuffer += iterator.next().getInt(0)
+ try {
+ while (iterator.hasNext) {
+ outputBuffer.synchronized {
+ outputBuffer += iterator.next().getInt(0)
+ }
+ Thread.sleep(sleepPerRowReadMs)
}
- Thread.sleep(sleepPerRowReadMs)
+ } catch {
+ case _: InterruptedException => buffer.close()
Review Comment:
`tester.close()` will call `thread.interrupt()`
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org