Skip to content

Commit c24d69c

Browse files
committed
fix(sdk): ignore broken pipe errors on server shutdown
1 parent bb37448 commit c24d69c

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

internal/ipc/ipc.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"net"
99
"net/http"
1010
"sync"
11+
"syscall"
1112
"time"
1213

1314
"github.com/hashicorp/yamux"
@@ -69,7 +70,7 @@ func newIpcServer(l net.Listener, handler http.Handler, afterClose func(error) e
6970
if errors.Is(err, http.ErrServerClosed) { // not an error, client closed the connection
7071
err = nil
7172
}
72-
result.err = errors.Join(filterEOF(err), afterClose(err)) // EOF: only forward to the afterClose handler, but filter out internal forwarding
73+
result.err = errors.Join(filterBrokenPipe(filterEOF(err)), afterClose(err)) // EOF: only forward to the afterClose handler, but filter out internal forwarding
7374
close(result.done)
7475
}()
7576
return result
@@ -82,6 +83,13 @@ func filterEOF(err error) error {
8283
return err
8384
}
8485

86+
func filterBrokenPipe(err error) error {
87+
if errors.Is(err, syscall.EPIPE) {
88+
return nil
89+
}
90+
return err
91+
}
92+
8593
type ipcImpl struct {
8694
server *ipcServer
8795
teardown func() error

0 commit comments

Comments
 (0)