diff --git a/src/core/nginx.go b/src/core/nginx.go index f29f410ee..a1dda677e 100644 --- a/src/core/nginx.go +++ b/src/core/nginx.go @@ -123,14 +123,25 @@ func (n *NginxBinaryType) UpdateNginxDetailsFromProcesses(nginxProcesses []*Proc n.statusUrls = map[string]string{} n.statusUrlMutex.Unlock() + numberOfMasterProcesses := 0 + for _, process := range nginxProcesses { nginxDetails := n.GetNginxDetailsFromProcess(process) if process.IsMaster { + numberOfMasterProcesses++ n.nginxDetailsMap[nginxDetails.GetNginxId()] = nginxDetails } else { n.nginxWorkersMap[nginxDetails.GetNginxId()] = append(n.nginxWorkersMap[nginxDetails.GetNginxId()], nginxDetails) } } + + if len(n.nginxDetailsMap) != numberOfMasterProcesses { + log.Errorf( + "Multiple NGINX master processes detected with the same NGINX ID. Number of master processes is %d. Number of unique NGINX IDs is %d.", + numberOfMasterProcesses, + len(n.nginxDetailsMap), + ) + } } func (n *NginxBinaryType) GetChildProcesses() map[string][]*proto.NginxDetails { diff --git a/test/integration/vendor/github.com/nginx/agent/v2/src/core/nginx.go b/test/integration/vendor/github.com/nginx/agent/v2/src/core/nginx.go index f29f410ee..a1dda677e 100644 --- a/test/integration/vendor/github.com/nginx/agent/v2/src/core/nginx.go +++ b/test/integration/vendor/github.com/nginx/agent/v2/src/core/nginx.go @@ -123,14 +123,25 @@ func (n *NginxBinaryType) UpdateNginxDetailsFromProcesses(nginxProcesses []*Proc n.statusUrls = map[string]string{} n.statusUrlMutex.Unlock() + numberOfMasterProcesses := 0 + for _, process := range nginxProcesses { nginxDetails := n.GetNginxDetailsFromProcess(process) if process.IsMaster { + numberOfMasterProcesses++ n.nginxDetailsMap[nginxDetails.GetNginxId()] = nginxDetails } else { n.nginxWorkersMap[nginxDetails.GetNginxId()] = append(n.nginxWorkersMap[nginxDetails.GetNginxId()], nginxDetails) } } + + if len(n.nginxDetailsMap) != numberOfMasterProcesses { + log.Errorf( + "Multiple NGINX master processes detected with the same NGINX ID. Number of master processes is %d. Number of unique NGINX IDs is %d.", + numberOfMasterProcesses, + len(n.nginxDetailsMap), + ) + } } func (n *NginxBinaryType) GetChildProcesses() map[string][]*proto.NginxDetails { diff --git a/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go b/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go index f29f410ee..a1dda677e 100644 --- a/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go +++ b/test/performance/vendor/github.com/nginx/agent/v2/src/core/nginx.go @@ -123,14 +123,25 @@ func (n *NginxBinaryType) UpdateNginxDetailsFromProcesses(nginxProcesses []*Proc n.statusUrls = map[string]string{} n.statusUrlMutex.Unlock() + numberOfMasterProcesses := 0 + for _, process := range nginxProcesses { nginxDetails := n.GetNginxDetailsFromProcess(process) if process.IsMaster { + numberOfMasterProcesses++ n.nginxDetailsMap[nginxDetails.GetNginxId()] = nginxDetails } else { n.nginxWorkersMap[nginxDetails.GetNginxId()] = append(n.nginxWorkersMap[nginxDetails.GetNginxId()], nginxDetails) } } + + if len(n.nginxDetailsMap) != numberOfMasterProcesses { + log.Errorf( + "Multiple NGINX master processes detected with the same NGINX ID. Number of master processes is %d. Number of unique NGINX IDs is %d.", + numberOfMasterProcesses, + len(n.nginxDetailsMap), + ) + } } func (n *NginxBinaryType) GetChildProcesses() map[string][]*proto.NginxDetails {