uranusjr commented on code in PR #69302:
URL: https://github.com/apache/airflow/pull/69302#discussion_r3608385908


##########
ts-sdk/src/coordinator/log-channel.ts:
##########
@@ -99,7 +114,12 @@ export class LogChannel {
       event: `[${this.name}] ${record.event}`,
       timestamp: record.timestamp ?? new Date().toISOString(),
     });
-    this.sock.write(Buffer.from(line + "\n", "utf8"));
+    const payload = line + "\n";
+    if (!this.shared.connected) {
+      process.stderr.write(payload);
+      return;
+    }
+    this.shared.sock.write(Buffer.from(payload, "utf8"));

Review Comment:
   If the peer dies but the error/close hasn't been processed, `connected` is 
still true, so `shared.sock.write()` runs on a dead socket and the record is 
lost. Maybe also check `shared.sock.writable` before writing and fall back to 
stderr if false?



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

Reply via email to