Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
Mirrored from https://github.com/Slazee/caddy.git
Synced Nov 14, 05:15 UTC
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.
Matthew Holt committed
Mar 27, 2019 at 12:36 UTC
27ff6aeccb99995880a86ee482dd90c1e5c85d85
4 files changed
+7
-6
.gitignore
+5
-1
@@ -1 +1,5 @@
1
-_gitignore/
\ No newline at end of file
1
+_gitignore/
2
+
3
+# artifacts from pprof tooling
4
+*.prof
5
+*.test
admin.go
+1
-1
@@ -33,7 +33,7 @@ func StartAdmin(addr string) error {
33
mux := http.NewServeMux()
34
mux.HandleFunc("/load", handleLoadConfig)
35
36
- ///// BEGIN PPROF STUFF //////
36
+ ///// BEGIN PPROF STUFF (TODO: Temporary) /////
37
mux.HandleFunc("/debug/pprof/", pprof.Index)
38
mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline)
39
mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
caddy.go
-4
@@ -4,7 +4,6 @@ import (
4
"encoding/json"
5
"fmt"
6
"log"
7
- "runtime/debug"
7
"strings"
8
"sync"
9
"time"
@@ -49,9 +48,6 @@ func Start(cfg Config) error {
48
currentCfg = &cfg
49
currentCfgMu.Unlock()
50
52
- // TODO: debugging memory leak...
53
- debug.FreeOSMemory()
54
-
51
return nil
52
}
53
modules/caddyhttp/caddyhttp.go
+1
@@ -49,6 +49,7 @@ func (hc *httpModuleConfig) Run() error {
49
return fmt.Errorf("%s: listening on %s: %v", proto, addr, err)
50
}
51
go s.Serve(ln)
52
+ hc.servers = append(hc.servers, s)
53
}
54
}
55
}