From 62e220fb73e76a75da988725175e1c941c45c6b1 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Wed, 8 Jan 2025 13:52:46 +0100 Subject: [PATCH] Don't exit tablet server on reloading invalid ACL This fixes potentially bringing down a tablet with an innocuous SIGHUP. It also logs the fact it's reading the ACL file, to fix not getting any feedback on SIGHUP. https://github.com/vitessio/vitess/issues/17139 Signed-off-by: Wiebe Cazemier --- go/vt/tableacl/tableacl.go | 4 ++-- go/vt/vttablet/tabletserver/tabletserver.go | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go/vt/tableacl/tableacl.go b/go/vt/tableacl/tableacl.go index 1b236cb1812..9d6762b4adb 100644 --- a/go/vt/tableacl/tableacl.go +++ b/go/vt/tableacl/tableacl.go @@ -107,14 +107,14 @@ func (tacl *tableACL) init(configFile string, aclCB func()) error { } data, err := os.ReadFile(configFile) if err != nil { - log.Infof("unable to read tableACL config file: %v Error: %v", configFile, err) + log.Errorf("unable to read tableACL config file: %v Error: %v", configFile, err) return err } config := &tableaclpb.Config{} if err := config.UnmarshalVT(data); err != nil { // try to parse tableacl as json file if jsonErr := json2.UnmarshalPB(data, config); jsonErr != nil { - log.Infof("unable to parse tableACL config file as a protobuf or json file. protobuf err: %v json err: %v", err, jsonErr) + log.Errorf("unable to parse tableACL config file as a protobuf or json file. protobuf err: %v json err: %v", err, jsonErr) return fmt.Errorf("unable to unmarshal Table ACL data: %s", data) } } diff --git a/go/vt/vttablet/tabletserver/tabletserver.go b/go/vt/vttablet/tabletserver/tabletserver.go index deeac10bd05..e86179eb9c9 100644 --- a/go/vt/vttablet/tabletserver/tabletserver.go +++ b/go/vt/vttablet/tabletserver/tabletserver.go @@ -382,8 +382,9 @@ func (tsv *TabletServer) InitACL(tableACLConfigFile string, enforceTableACLConfi sigChan := make(chan os.Signal, 1) signal.Notify(sigChan, syscall.SIGHUP) go func() { - for range sigChan { - tsv.initACL(tableACLConfigFile, enforceTableACLConfig) + for sig := range sigChan { + log.Infof("Signal '%v' received, reloading ACL", sig) + tsv.initACL(tableACLConfigFile, false) } }()