Re: [PR] [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block [spark]
jwang0306 commented on code in PR #45238: URL: https://github.com/apache/spark/pull/45238#discussion_r1505389956 ## core/src/main/scala/org/apache/spark/serializer/JavaSerializer.scala: ## @@ -118,22 +118,24 @@ private[spark] class JavaSerializerInstance( override def serialize[T: ClassTag](t: T): ByteBuffer = { val bos = new ByteBufferOutputStream() -val out = serializeStream(bos) -out.writeObject(t) -out.close() +Utils.tryWithResource(serializeStream(bos)) { out => Review Comment: Ack, thanks for pointing this out. I'll handle them together as suggested. -- 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
Re: [PR] [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block [spark]
jwang0306 commented on PR #45238: URL: https://github.com/apache/spark/pull/45238#issuecomment-1969964182 > These are ByteArray Input/Output Stream's - which are scoped to that specific method; I am not sure I see value in wrapping it. Thanks for the input, @mridulm. At the moment I don't have a strong technical justification for this. Despite the fact that exceptions may be thrown potentially leading to resources not being released in a timely manner, admittedly there's no underlying expensive resources that need to be closed within these streams. I was simply considering the closing of streams after use as a good practice. I'm open to any decision regarding this PR, whether it be to close or merge it. WDYT? -- 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
Re: [PR] [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block [spark]
github-actions[bot] commented on PR #45238: URL: https://github.com/apache/spark/pull/45238#issuecomment-2155719350 We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable. If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag! -- 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
Re: [PR] [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block [spark]
github-actions[bot] closed pull request #45238: [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block URL: https://github.com/apache/spark/pull/45238 -- 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
Re: [PR] [SPARK-47153][CORE] Guard serialize/deserialize in JavaSerializer with try-with-resource block [spark]
LuciferYang commented on code in PR #45238: URL: https://github.com/apache/spark/pull/45238#discussion_r1503688318 ## core/src/main/scala/org/apache/spark/serializer/JavaSerializer.scala: ## @@ -118,22 +118,24 @@ private[spark] class JavaSerializerInstance( override def serialize[T: ClassTag](t: T): ByteBuffer = { val bos = new ByteBufferOutputStream() -val out = serializeStream(bos) -out.writeObject(t) -out.close() +Utils.tryWithResource(serializeStream(bos)) { out => Review Comment: There should be other similar cases, for example: https://github.com/apache/spark/blob/1a408033daf458f1ceebbe14a560355a1a2c0a70/core/src/main/scala/org/apache/spark/scheduler/TaskDescription.scala#L92-L94 https://github.com/apache/spark/blob/1a408033daf458f1ceebbe14a560355a1a2c0a70/sql/core/src/main/scala/org/apache/spark/sql/execution/arrow/ArrowConverters.scala#L473 cc @mridulm -- 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