Skip to content

Commit ac1f655

Browse files
🐛 truncate termination log file (#32)
This change truncates the termination log before writing so only the cause of the current container crash is shown Signed-off-by: Prashant Gupta <[email protected]> Signed-off-by: Joe Runde <[email protected]> Co-authored-by: PRASHANT GUPTA <[email protected]>
1 parent b1d5c76 commit ac1f655

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

launcher/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ fn resolve_tokenizer_path(model_name: &str, revision: Option<&str>) -> Result<St
747747
fn write_termination_log(msg: &str) -> Result<(), io::Error> {
748748
// Writes a message to the termination log.
749749
// Creates the logfile if it doesn't exist.
750-
let mut f = File::options().write(true).create(true).open("/dev/termination-log")?;
750+
let mut f = File::options().write(true).create(true).truncate(true).open("/dev/termination-log")?;
751751
writeln!(f, "{}", msg)?;
752752
Ok(())
753753
}

router/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ fn validate_args(args: &Args) {
188188
fn write_termination_log(msg: &str) -> Result<(), io::Error> {
189189
// Writes a message to the termination log.
190190
// Creates the logfile if it doesn't exist.
191-
let mut f = File::options().write(true).create(true).open("/dev/termination-log")?;
191+
let mut f = File::options().write(true).create(true).truncate(true).open("/dev/termination-log")?;
192192
writeln!(f, "{}", msg)?;
193193
Ok(())
194194
}

0 commit comments

Comments
 (0)