dongjoon-hyun commented on code in PR #54280:
URL: https://github.com/apache/spark/pull/54280#discussion_r2797272677


##########
core/src/main/scala/org/apache/spark/deploy/history/EventLogFileWriters.scala:
##########
@@ -131,7 +131,20 @@ abstract class EventLogFileWriter(
   }
 
   protected def closeWriter(): Unit = {
+    // 1. Flush first to check the errors
+    writer.foreach(_.flush())
+    if (writer.exists(_.checkError())) {
+      logWarning("Spark detects errors while flushing event logs.")
+    }
+    hadoopDataStream.foreach(_.hflush())

Review Comment:
   This PR aims to avoid a silent failure inside `checkError`. For other 
propagatable unhandled IOException, `SparkContext.stop` already logs like the 
following. So, I didn't use `try ... catch ...` or `Utils.tryLog...` 
intentionally.
   
   
https://github.com/apache/spark/blob/59f3a16590d8a8e1c942be8d129343a378e674d1/core/src/main/scala/org/apache/spark/SparkContext.scala#L2380-L2382
   
   
https://github.com/apache/spark/blob/59f3a16590d8a8e1c942be8d129343a378e674d1/core/src/main/scala/org/apache/spark/deploy/history/EventLogFileWriters.scala#L356-L363
   
   In my case, the silent failure happens before `renameFile`. So, the last log 
file is not uploaded correctly and `inprogress` file remains. As a result, SHS 
shows running stages always because it's not finished.



-- 
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]

Reply via email to