mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 13:43:47 +03:00
Fix goroutine leak in Run
D'oh, the servers' Shutdown() would never be called because they were never added to the list of servers. Thanks Danny for finding this.
This commit is contained in:
parent
a8dc73b4d9
commit
27ff6aeccb
4 changed files with 7 additions and 6 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1 +1,5 @@
|
||||||
_gitignore/
|
_gitignore/
|
||||||
|
|
||||||
|
# artifacts from pprof tooling
|
||||||
|
*.prof
|
||||||
|
*.test
|
||||||
|
|
2
admin.go
2
admin.go
|
@ -33,7 +33,7 @@ func StartAdmin(addr string) error {
|
||||||
mux := http.NewServeMux()
|
mux := http.NewServeMux()
|
||||||
mux.HandleFunc("/load", handleLoadConfig)
|
mux.HandleFunc("/load", handleLoadConfig)
|
||||||
|
|
||||||
///// BEGIN PPROF STUFF //////
|
///// BEGIN PPROF STUFF (TODO: Temporary) /////
|
||||||
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
mux.HandleFunc("/debug/pprof/", pprof.Index)
|
||||||
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
|
||||||
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
|
||||||
|
|
4
caddy.go
4
caddy.go
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"runtime/debug"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
@ -49,9 +48,6 @@ func Start(cfg Config) error {
|
||||||
currentCfg = &cfg
|
currentCfg = &cfg
|
||||||
currentCfgMu.Unlock()
|
currentCfgMu.Unlock()
|
||||||
|
|
||||||
// TODO: debugging memory leak...
|
|
||||||
debug.FreeOSMemory()
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ func (hc *httpModuleConfig) Run() error {
|
||||||
return fmt.Errorf("%s: listening on %s: %v", proto, addr, err)
|
return fmt.Errorf("%s: listening on %s: %v", proto, addr, err)
|
||||||
}
|
}
|
||||||
go s.Serve(ln)
|
go s.Serve(ln)
|
||||||
|
hc.servers = append(hc.servers, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue