Skip to content

Commit

Permalink
Add error log if duplicate NGINX IDs are found due to multiple NGINX …
Browse files Browse the repository at this point in the history
…instances running. (#477)
  • Loading branch information
dhurley authored Sep 21, 2023
1 parent 97eda9a commit 0dde035
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/core/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0dde035

Please sign in to comment.