brumi1024 commented on code in PR #8556:
URL: https://github.com/apache/hadoop/pull/8556#discussion_r3855055879


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/logaggregation/filecontroller/ifile/LogAggregationIndexedFileController.java:
##########
@@ -237,12 +263,14 @@ public Object run() throws Exception {
     } catch (Exception e) {
       throw new IOException(e);
     }
+    this.writeSession = session;

Review Comment:
   I think this assignment happens too late to make initialization 
exception-safe. If any filesystem operation throws after session.fsDataOStream 
is opened, the new session is never assigned to writeSession. 
AppLogAggregatorImpl will still call closeWriter() from its finally block, but 
that method can only close the previous session or do nothing. This can leak 
the output stream and its HDFS lease, leaving a partial file and potentially 
blocking subsequent aggregation attempts.
   
   Closing session.fsDataOStream directly when initialization fails, and 
clearing writeSession in closeWriter() after cleanup could solve this.



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