mirror of
https://github.com/turbot/steampipe.git
synced 2025-12-23 21:09:15 -05:00
This commit is contained in:
@@ -111,6 +111,9 @@ func setBaseDefaults() error {
|
|||||||
// memory
|
// memory
|
||||||
pconstants.ArgMemoryMaxMbPlugin: 1024,
|
pconstants.ArgMemoryMaxMbPlugin: 1024,
|
||||||
pconstants.ArgMemoryMaxMb: 1024,
|
pconstants.ArgMemoryMaxMb: 1024,
|
||||||
|
|
||||||
|
// plugin start timeout
|
||||||
|
pconstants.ArgPluginStartTimeout: constants.PluginStartTimeout.Seconds(),
|
||||||
}
|
}
|
||||||
|
|
||||||
for k, v := range defaults {
|
for k, v := range defaults {
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ var (
|
|||||||
DBRecoveryTimeout = 24 * time.Hour
|
DBRecoveryTimeout = 24 * time.Hour
|
||||||
DBRecoveryRetryBackoff = 200 * time.Millisecond
|
DBRecoveryRetryBackoff = 200 * time.Millisecond
|
||||||
ServicePingInterval = 50 * time.Millisecond
|
ServicePingInterval = 50 * time.Millisecond
|
||||||
PluginStartTimeout = 30 * time.Second
|
PluginStartTimeout = 3 * time.Minute
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ func (t *Plugin) ConfigMap() map[string]interface{} {
|
|||||||
}
|
}
|
||||||
if t.StartTimeout != nil {
|
if t.StartTimeout != nil {
|
||||||
res[constants.ArgPluginStartTimeout] = t.StartTimeout
|
res[constants.ArgPluginStartTimeout] = t.StartTimeout
|
||||||
} else {
|
|
||||||
res[constants.ArgPluginStartTimeout] = constants.PluginStartTimeout.Seconds()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
|
|||||||
@@ -6,9 +6,11 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/hashicorp/go-hclog"
|
"github.com/hashicorp/go-hclog"
|
||||||
"github.com/hashicorp/go-plugin"
|
"github.com/hashicorp/go-plugin"
|
||||||
|
"github.com/spf13/viper"
|
||||||
"github.com/turbot/pipe-fittings/v2/app_specific"
|
"github.com/turbot/pipe-fittings/v2/app_specific"
|
||||||
"github.com/turbot/pipe-fittings/v2/constants"
|
"github.com/turbot/pipe-fittings/v2/constants"
|
||||||
"github.com/turbot/steampipe-plugin-sdk/v5/logging"
|
"github.com/turbot/steampipe-plugin-sdk/v5/logging"
|
||||||
@@ -64,6 +66,7 @@ func start(steampipeExecutablePath string) (*State, error) {
|
|||||||
Cmd: pluginManagerCmd,
|
Cmd: pluginManagerCmd,
|
||||||
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
|
AllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},
|
||||||
Logger: logger,
|
Logger: logger,
|
||||||
|
StartTimeout: time.Duration(viper.GetInt(constants.ArgPluginStartTimeout)) * time.Second,
|
||||||
})
|
})
|
||||||
|
|
||||||
if _, err := client.Start(); err != nil {
|
if _, err := client.Start(); err != nil {
|
||||||
|
|||||||
@@ -501,11 +501,16 @@ func (m *PluginManager) startPluginProcess(pluginInstance string, connectionConf
|
|||||||
|
|
||||||
cmd := exec.Command(pluginPath)
|
cmd := exec.Command(pluginPath)
|
||||||
m.setPluginMaxMemory(pluginConfig, cmd)
|
m.setPluginMaxMemory(pluginConfig, cmd)
|
||||||
|
|
||||||
|
pluginStartTimeoutDuration := time.Duration(viper.GetInt64(pconstants.ArgPluginStartTimeout)) * time.Second
|
||||||
|
log.Printf("[TRACE] %s pluginStartTimeoutDuration: %s", pluginPath, pluginStartTimeoutDuration)
|
||||||
|
|
||||||
client := goplugin.NewClient(&goplugin.ClientConfig{
|
client := goplugin.NewClient(&goplugin.ClientConfig{
|
||||||
HandshakeConfig: sdkshared.Handshake,
|
HandshakeConfig: sdkshared.Handshake,
|
||||||
Plugins: pluginMap,
|
Plugins: pluginMap,
|
||||||
Cmd: cmd,
|
Cmd: cmd,
|
||||||
AllowedProtocols: []goplugin.Protocol{goplugin.ProtocolGRPC},
|
AllowedProtocols: []goplugin.Protocol{goplugin.ProtocolGRPC},
|
||||||
|
StartTimeout: pluginStartTimeoutDuration,
|
||||||
|
|
||||||
// pass our logger to the plugin client to ensure plugin logs end up in logfile
|
// pass our logger to the plugin client to ensure plugin logs end up in logfile
|
||||||
Logger: m.logger,
|
Logger: m.logger,
|
||||||
@@ -678,14 +683,10 @@ func (m *PluginManager) waitForPluginLoad(p *runningPlugin, req *pb.GetRequest)
|
|||||||
}
|
}
|
||||||
pluginStartTimeoutSecs := pluginConfig.GetStartTimeout()
|
pluginStartTimeoutSecs := pluginConfig.GetStartTimeout()
|
||||||
if pluginStartTimeoutSecs == 0 {
|
if pluginStartTimeoutSecs == 0 {
|
||||||
if viper.IsSet(pconstants.ArgMemoryMaxMbPlugin) {
|
if viper.IsSet(pconstants.ArgPluginStartTimeout) {
|
||||||
pluginStartTimeoutSecs = viper.GetInt64(pconstants.ArgPluginStartTimeout)
|
pluginStartTimeoutSecs = viper.GetInt64(pconstants.ArgPluginStartTimeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if pluginStartTimeoutSecs == 0 {
|
|
||||||
// if we don't have any timeout set use 30 seconds
|
|
||||||
pluginStartTimeoutSecs = int64(30)
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Printf("[TRACE] waitForPluginLoad: waiting %d seconds (%p)", pluginStartTimeoutSecs, req)
|
log.Printf("[TRACE] waitForPluginLoad: waiting %d seconds (%p)", pluginStartTimeoutSecs, req)
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ var steampipeVersion = "1.1.0"
|
|||||||
// A pre-release marker for the version. If this is "" (empty string)
|
// A pre-release marker for the version. If this is "" (empty string)
|
||||||
// then it means that it is a final release. Otherwise, this is a pre-release
|
// then it means that it is a final release. Otherwise, this is a pre-release
|
||||||
// such as "dev" (in development), "beta", "rc1", etc.
|
// such as "dev" (in development), "beta", "rc1", etc.
|
||||||
var prerelease = "alpha.0"
|
var prerelease = "rc.0"
|
||||||
|
|
||||||
// SteampipeVersion is an instance of semver.Version. This has the secondary
|
// SteampipeVersion is an instance of semver.Version. This has the secondary
|
||||||
// benefit of verifying during tests and init time that our version is a
|
// benefit of verifying during tests and init time that our version is a
|
||||||
|
|||||||
Reference in New Issue
Block a user