Skip to content

Commit

Permalink
Increasing thrift's ServerConnectivityCheckInterval from 5ms to 100ms.
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ Barrett committed May 8, 2023
1 parent 95aad42 commit d06a45b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions cmd/grpc.ext/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions cmd/launcher.ext/launcher-extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions cmd/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down
1 change: 0 additions & 1 deletion pkg/osquery/interactive/interactive.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions pkg/osquery/interactive/interactive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,9 @@ func TestProc(t *testing.T) {
errContainsStr: "error waiting for osquery to create socket",
},
}
for _, tt := range tests {
for _, tt := range tests { // nolint:paralleltest
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

rootDir := t.TempDir()
require.NoError(t, downloadOsquery(rootDir))
osquerydPath := filepath.Join(rootDir, "osqueryd")
Expand Down
3 changes: 3 additions & 0 deletions pkg/osquery/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d06a45b

Please sign in to comment.