plugin: a failed write to the plugin host ends the host before its caller hears of it, so a call freed by the failure finds the host already gone (TestHostWriterFailureWakesWaiters, red on macOS CI) (#1214)

This commit is contained in:
forever authored and GitHub committed 2026-10-08 06:19:50 +08:00
1 parent e22d5eef81
commit e24b332051
1 file changed
+5 -1
+5 -1
View File
@@ -988,11 +988,15 @@ func (h *host) writerLoop() {
return
}
_, err := h.in.Write(req.b)
if err != nil {
// End the host before the writer's caller hears of it, so a
// caller freed by the failure finds the host already dead.
h.fail(fmt.Errorf("writing to the plugin host: %w", err))
}
if req.done != nil {
req.done <- err
}
if err != nil {
h.fail(fmt.Errorf("writing to the plugin host: %w", err))
return
}
}