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: ...@@ -216,6 +216,8 @@ To set up your own custom configuration for the agent:
* Default: 7 * Default: 7
* LongRunningWorkerMonitorIntervalSeconds (int) * LongRunningWorkerMonitorIntervalSeconds (int)
* Default: 60 * Default: 60
* GoMaxProcForAgentWorker (int)
* Default: 0
* Os - represents os related information, will be logged in reply messages * Os - represents os related information, will be logged in reply messages
* Lang (string) * Lang (string)
* Default: "en-US" * Default: "en-US"
......
...@@ -2,9 +2,18 @@ ...@@ -2,9 +2,18 @@
package main 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() { func main() {
config, _ := appconfig.Config(false)
// will use default when the value is less than one
runtime.GOMAXPROCS(config.Agent.GoMaxProcForAgentWorker)
// initialize logger // initialize logger
log := logger.SSMLogger(true) log := logger.SSMLogger(true)
defer log.Close() defer log.Close()
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
package main package main
import ( 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/log/ssmlog"
"github.com/aws/amazon-ssm-agent/agent/longrunning/plugin/cloudwatch" "github.com/aws/amazon-ssm-agent/agent/longrunning/plugin/cloudwatch"
) )
...@@ -11,6 +14,10 @@ const serviceName = "AmazonSSMAgent" ...@@ -11,6 +14,10 @@ const serviceName = "AmazonSSMAgent"
const imageStateComplete = "IMAGE_STATE_COMPLETE" const imageStateComplete = "IMAGE_STATE_COMPLETE"
func main() { func main() {
config, _ := appconfig.Config(false)
// will use default when the value is less than one
runtime.GOMAXPROCS(config.Agent.GoMaxProcForAgentWorker)
// initialize logger // initialize logger
log := ssmlog.SSMLogger(true) log := ssmlog.SSMLogger(true)
defer log.Close() defer log.Close()
......
...@@ -127,6 +127,7 @@ func DefaultConfig() SsmagentConfig { ...@@ -127,6 +127,7 @@ func DefaultConfig() SsmagentConfig {
AuditExpirationDay: DefaultAuditExpirationDay, AuditExpirationDay: DefaultAuditExpirationDay,
LongRunningWorkerMonitorIntervalSeconds: defaultLongRunningWorkerMonitorIntervalSeconds, LongRunningWorkerMonitorIntervalSeconds: defaultLongRunningWorkerMonitorIntervalSeconds,
ForceFileIPC: false, ForceFileIPC: false,
GoMaxProcForAgentWorker: 0,
} }
var os = OsInfo{ var os = OsInfo{
Lang: "en-US", Lang: "en-US",
......
...@@ -17,6 +17,7 @@ package appconfig ...@@ -17,6 +17,7 @@ package appconfig
import ( import (
"log" "log"
"runtime"
) )
//func parser(config *T) { //func parser(config *T) {
...@@ -45,6 +46,11 @@ func parser(config *SsmagentConfig) { ...@@ -45,6 +46,11 @@ func parser(config *SsmagentConfig) {
DefaultSsmSelfUpdateFrequencyDaysMin, DefaultSsmSelfUpdateFrequencyDaysMin,
DefaultSsmSelfUpdateFrequencyDaysMax, DefaultSsmSelfUpdateFrequencyDaysMax,
DefaultSsmSelfUpdateFrequencyDays) DefaultSsmSelfUpdateFrequencyDays)
config.Agent.GoMaxProcForAgentWorker = getNumericValue(config.Agent.GoMaxProcForAgentWorker,
1,
runtime.NumCPU(),
0)
config.Agent.AuditExpirationDay = getNumericValue( config.Agent.AuditExpirationDay = getNumericValue(
config.Agent.AuditExpirationDay, config.Agent.AuditExpirationDay,
DefaultAuditExpirationDayMin, DefaultAuditExpirationDayMin,
......
...@@ -68,6 +68,8 @@ type AgentInfo struct { ...@@ -68,6 +68,8 @@ type AgentInfo struct {
LongRunningWorkerMonitorIntervalSeconds int LongRunningWorkerMonitorIntervalSeconds int
AuditExpirationDay int AuditExpirationDay int
ForceFileIPC bool ForceFileIPC bool
// denotes GOMAXPROCS value for legacy agent worker
GoMaxProcForAgentWorker int
} }
// MgsConfig represents configuration for Message Gateway service // 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