Commit 4404d8d4 authored by Vishnu Karthik Ravindran's avatar Vishnu Karthik Ravindran Committed by Faho Shubladze
Browse files

band-aid fix to avoid random window faults

cr: https://code.amazon.com/reviews/CR-54083211
parent 2d77c32c
......@@ -216,6 +216,8 @@ To set up your own custom configuration for the agent:
* Default: 7
* LongRunningWorkerMonitorIntervalSeconds (int)
* Default: 60
* GoMaxProcForAgentWorker (int)
* Default: 0
* Os - represents os related information, will be logged in reply messages
* Lang (string)
* Default: "en-US"
......
......@@ -2,9 +2,18 @@
package main
import logger "github.com/aws/amazon-ssm-agent/agent/log/ssmlog"
import (
"runtime"
"github.com/aws/amazon-ssm-agent/agent/appconfig"
logger "github.com/aws/amazon-ssm-agent/agent/log/ssmlog"
)
func main() {
config, _ := appconfig.Config(false)
// will use default when the value is less than one
runtime.GOMAXPROCS(config.Agent.GoMaxProcForAgentWorker)
// initialize logger
log := logger.SSMLogger(true)
defer log.Close()
......
......@@ -3,6 +3,9 @@
package main
import (
"runtime"
"github.com/aws/amazon-ssm-agent/agent/appconfig"
"github.com/aws/amazon-ssm-agent/agent/log/ssmlog"
"github.com/aws/amazon-ssm-agent/agent/longrunning/plugin/cloudwatch"
)
......@@ -11,6 +14,10 @@ const serviceName = "AmazonSSMAgent"
const imageStateComplete = "IMAGE_STATE_COMPLETE"
func main() {
config, _ := appconfig.Config(false)
// will use default when the value is less than one
runtime.GOMAXPROCS(config.Agent.GoMaxProcForAgentWorker)
// initialize logger
log := ssmlog.SSMLogger(true)
defer log.Close()
......
......@@ -127,6 +127,7 @@ func DefaultConfig() SsmagentConfig {
AuditExpirationDay: DefaultAuditExpirationDay,
LongRunningWorkerMonitorIntervalSeconds: defaultLongRunningWorkerMonitorIntervalSeconds,
ForceFileIPC: false,
GoMaxProcForAgentWorker: 0,
}
var os = OsInfo{
Lang: "en-US",
......
......@@ -17,6 +17,7 @@ package appconfig
import (
"log"
"runtime"
)
//func parser(config *T) {
......@@ -45,6 +46,11 @@ func parser(config *SsmagentConfig) {
DefaultSsmSelfUpdateFrequencyDaysMin,
DefaultSsmSelfUpdateFrequencyDaysMax,
DefaultSsmSelfUpdateFrequencyDays)
config.Agent.GoMaxProcForAgentWorker = getNumericValue(config.Agent.GoMaxProcForAgentWorker,
1,
runtime.NumCPU(),
0)
config.Agent.AuditExpirationDay = getNumericValue(
config.Agent.AuditExpirationDay,
DefaultAuditExpirationDayMin,
......
......@@ -68,6 +68,8 @@ type AgentInfo struct {
LongRunningWorkerMonitorIntervalSeconds int
AuditExpirationDay int
ForceFileIPC bool
// denotes GOMAXPROCS value for legacy agent worker
GoMaxProcForAgentWorker int
}
// MgsConfig represents configuration for Message Gateway service
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment