summaryrefslogtreecommitdiff
path: root/modules/caddytls/tls.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2020-05-12 11:36:20 -0600
commitaef560c7fc52092a412d9e97112b8cb879c5eda5 (patch)
tree905fce22478842dd8a8d07a65c8769e7db1c4cad /modules/caddytls/tls.go
parent44536a7594f060dfca54a3cfb36135c93cba8e59 (diff)
all: Recover from panics in goroutines
Diffstat (limited to 'modules/caddytls/tls.go')
-rw-r--r--modules/caddytls/tls.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/caddytls/tls.go b/modules/caddytls/tls.go
index 0e92f05..7f2d23e 100644
--- a/modules/caddytls/tls.go
+++ b/modules/caddytls/tls.go
@@ -19,9 +19,11 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
+ "log"
"net/http"
"os"
"path/filepath"
+ "runtime/debug"
"strings"
"sync"
"time"
@@ -367,6 +369,11 @@ func (t *TLS) keepStorageClean() {
t.storageCleanTicker = time.NewTicker(storageCleanInterval)
t.storageCleanStop = make(chan struct{})
go func() {
+ defer func() {
+ if err := recover(); err != nil {
+ log.Printf("[PANIC] storage cleaner: %v\n%s", err, debug.Stack())
+ }
+ }()
for {
select {
case <-t.storageCleanStop: