Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adapter memory leak #1967

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions adapter/internal/discovery/xds/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ var (
// Envoy Label as map key
gatewayLabelConfigMap map[string]*EnvoyGatewayConfig // GW-Label -> EnvoyGatewayConfig struct map

// Listener as map key
listenerToRouteArrayMap map[string][]*routev3.Route // Listener -> Routes map

// Common Enforcer Label as map key
// This doesn't have a usage yet. It will be used to handle multiple enforcer labels in future.
enforcerLabelMap map[string]*EnforcerInternalAPI // Enforcer Label -> EnforcerInternalAPI struct map
Expand Down Expand Up @@ -159,7 +156,6 @@ func init() {
enforcerThrottleDataCache = wso2_cache.NewSnapshotCache(false, IDHash{}, nil)
enforcerJwtIssuerCache = wso2_cache.NewSnapshotCache(false, IDHash{}, nil)
gatewayLabelConfigMap = make(map[string]*EnvoyGatewayConfig)
listenerToRouteArrayMap = make(map[string][]*routev3.Route)
orgAPIMap = make(map[string]map[string]*EnvoyInternalAPI)
orgIDAPIvHostsMap = make(map[string]map[string][]string) // organizationID -> UUID-prod/sand -> Envoy Vhost Array map
orgIDvHostBasepathMap = make(map[string]map[string]string)
Expand Down Expand Up @@ -741,16 +737,6 @@ func UpdateAPICache(vHosts []string, newLabels []string, listener string, sectio
endpointAddresses: endpoints,
enforcerAPI: oasParser.GetEnforcerAPI(adapterInternalAPI, vHost),
}
if _, ok := listenerToRouteArrayMap[listener]; ok {
routesList := listenerToRouteArrayMap[listener]
if routesList == nil {
routesList = make([]*routev3.Route, 0)
}
routesList = append(routesList, routes...)
listenerToRouteArrayMap[listener] = routesList
} else {
listenerToRouteArrayMap[listener] = routes
}
}
return updatedLabelsMap, nil
}
Expand Down
Loading