Skip to content

Commit ed369b5

Browse files
author
Jeffrey Damick
committed
Force early cleanup of an instance when the instance list is re-sliced on Stop() & Restart() to prevent holding memory
Signed-off-by: Jeffrey Damick <[email protected]>
1 parent 51e3ec7 commit ed369b5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

caddy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ func (i *Instance) Stop() error {
149149
instancesMu.Lock()
150150
for j, other := range instances {
151151
if other == i {
152+
instances[j] = nil
152153
instances = append(instances[:j], instances[j+1:]...)
153154
break
154155
}
@@ -502,6 +503,7 @@ func startWithListenerFds(cdyfile Input, inst *Instance, restartFds map[string][
502503
instancesMu.Lock()
503504
for i, otherInst := range instances {
504505
if otherInst == inst {
506+
instances[i] = nil
505507
instances = append(instances[:i], instances[i+1:]...)
506508
break
507509
}

0 commit comments

Comments
 (0)