File tree 1 file changed +24
-1
lines changed
components/supervisor/pkg/ports
1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
16
16
"reflect"
17
17
"sort"
18
18
"sync"
19
+ "syscall"
19
20
"time"
20
21
21
22
"golang.org/x/net/nettest"
@@ -760,8 +761,30 @@ func startLocalhostProxy(port uint32) (io.Closer, error) {
760
761
originalDirector (req )
761
762
}
762
763
proxy .ErrorHandler = func (rw http.ResponseWriter , req * http.Request , err error ) {
763
- log .WithError (err ).WithField ("local-port" , port ).WithField ("url" , req .URL .String ()).Warn ("localhost proxy request failed" )
764
764
rw .WriteHeader (http .StatusBadGateway )
765
+
766
+ // avoid common warnings
767
+
768
+ if errors .Is (err , context .Canceled ) {
769
+ return
770
+ }
771
+
772
+ if errors .Is (err , io .EOF ) {
773
+ return
774
+ }
775
+
776
+ if errors .Is (err , syscall .ECONNREFUSED ) {
777
+ return
778
+ }
779
+
780
+ var netOpErr * net.OpError
781
+ if errors .As (err , & netOpErr ) {
782
+ if netOpErr .Op == "read" {
783
+ return
784
+ }
785
+ }
786
+
787
+ log .WithError (err ).WithField ("local-port" , port ).WithField ("url" , req .URL .String ()).Warn ("localhost proxy request failed" )
765
788
}
766
789
767
790
proxyAddr := fmt .Sprintf ("%v:%d" , workspaceIPAdress , port )
You can’t perform that action at this time.
0 commit comments