Skip to content

Commit 4932ba7

Browse files
committed
fix: Leaking yamux session after HTTP handler is closed
Closes #317. We depended on the context canceling the yamux connection, but this isn't a sync operation. Explicitly calling close ensures the handler waits for yamux to complete before exit.
1 parent 4c71ff9 commit 4932ba7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

coderd/provisionerdaemons.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ func (api *api) provisionerDaemonsServe(rw http.ResponseWriter, r *http.Request)
8484
_ = conn.Close(websocket.StatusInternalError, fmt.Sprintf("multiplex server: %s", err))
8585
return
8686
}
87+
defer func() {
88+
_ = session.Close()
89+
}()
8790
mux := drpcmux.New()
8891
err = proto.DRPCRegisterProvisionerDaemon(mux, &provisionerdServer{
8992
ID: daemon.ID,

0 commit comments

Comments
 (0)