From 41c7d0f0709658e588c24765fc724696926dd2a4 Mon Sep 17 00:00:00 2001 From: CJ Barrett Date: Mon, 8 May 2023 12:26:12 -0400 Subject: [PATCH] Increasing thrift's ServerConnectivityCheckInterval from 5ms to 100ms. (#1173) --- cmd/grpc.ext/grpc.go | 3 +++ cmd/launcher.ext/launcher-extension.go | 3 +++ cmd/launcher/launcher.go | 3 +++ pkg/osquery/interactive/interactive.go | 1 - pkg/osquery/runtime/runtime_test.go | 3 +++ 5 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmd/grpc.ext/grpc.go b/cmd/grpc.ext/grpc.go index 884cef5b4..df9d27d5f 100644 --- a/cmd/grpc.ext/grpc.go +++ b/cmd/grpc.ext/grpc.go @@ -10,6 +10,7 @@ import ( "path/filepath" "time" + "github.com/apache/thrift/lib/go/thrift" "github.com/go-kit/kit/log/level" "github.com/kolide/kit/env" "github.com/kolide/kit/logutil" @@ -106,6 +107,8 @@ func main() { logutil.Fatal(logger, "err", fmt.Errorf("starting grpc extension: %w", err), "stack", fmt.Sprintf("%+v", err)) } + thrift.ServerConnectivityCheckInterval = 100 * time.Millisecond + // create an extension server server, err := osquery.NewExtensionManagerServer( "com.kolide.grpc_extension", diff --git a/cmd/launcher.ext/launcher-extension.go b/cmd/launcher.ext/launcher-extension.go index a73520455..01fe5416d 100644 --- a/cmd/launcher.ext/launcher-extension.go +++ b/cmd/launcher.ext/launcher-extension.go @@ -6,6 +6,7 @@ import ( "os" "time" + "github.com/apache/thrift/lib/go/thrift" "github.com/go-kit/kit/log/level" "github.com/kolide/kit/logutil" "github.com/kolide/kit/version" @@ -35,6 +36,8 @@ func main() { // allow for osqueryd to create the socket path time.Sleep(2 * time.Second) + thrift.ServerConnectivityCheckInterval = 100 * time.Millisecond + // create an extension server server, err := osquery.NewExtensionManagerServer( "com.kolide.standalone_extension", diff --git a/cmd/launcher/launcher.go b/cmd/launcher/launcher.go index 58105df65..7d4ac927e 100644 --- a/cmd/launcher/launcher.go +++ b/cmd/launcher/launcher.go @@ -14,6 +14,7 @@ import ( "strconv" "time" + "github.com/apache/thrift/lib/go/thrift" "github.com/go-kit/kit/log" "github.com/go-kit/kit/log/level" "github.com/kolide/kit/logutil" @@ -56,6 +57,8 @@ const ( // rungroups with the various options, and goes! If autoupdate is // enabled, the finalizers will trigger various restarts. func runLauncher(ctx context.Context, cancel func(), opts *launcher.Options) error { + thrift.ServerConnectivityCheckInterval = 100 * time.Millisecond + logger := log.With(ctxlog.FromContext(ctx), "caller", log.DefaultCaller) // If delay_start is configured, wait before running launcher. diff --git a/pkg/osquery/interactive/interactive.go b/pkg/osquery/interactive/interactive.go index 148295b9b..c49486709 100644 --- a/pkg/osquery/interactive/interactive.go +++ b/pkg/osquery/interactive/interactive.go @@ -101,7 +101,6 @@ func buildOsqueryFlags(socketPath, augeasLensesPath string, osqueryFlags []strin } func loadExtensions(socketPath string, osquerydPath string) (*osquery.ExtensionManagerServer, error) { - extensionManagerServer, err := osquery.NewExtensionManagerServer( extensionName, socketPath, diff --git a/pkg/osquery/runtime/runtime_test.go b/pkg/osquery/runtime/runtime_test.go index 0603c56d7..e7b98796c 100644 --- a/pkg/osquery/runtime/runtime_test.go +++ b/pkg/osquery/runtime/runtime_test.go @@ -14,6 +14,7 @@ import ( "testing" "time" + "github.com/apache/thrift/lib/go/thrift" "github.com/go-kit/kit/log" "github.com/kolide/kit/fsutil" "github.com/kolide/kit/testutil" @@ -46,6 +47,8 @@ func TestMain(m *testing.M) { testOsqueryBinaryDirectory = filepath.Join(binDirectory, "osqueryd") + thrift.ServerConnectivityCheckInterval = 100 * time.Millisecond + if err := downloadOsqueryInBinDir(binDirectory); err != nil { fmt.Printf("Failed to download osquery: %v\n", err) os.Exit(1)