Skip to content

fix nil pointer #286

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

Merged
merged 2 commits into from
Nov 25, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion pkg/bootstrap/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"net/http"
"sync"

//nolint: gosec
_ "net/http/pprof" // pprof

"istio.io/istio/pkg/config/mesh"
Expand Down Expand Up @@ -241,7 +242,11 @@ func (s *Server) Start(stop <-chan struct{}) {
aerakiLog.Info("staring Aeraki Server")

// pprof server
go http.ListenAndServe("localhost:6060", nil)
go func() {
if err := http.ListenAndServe("localhost:6060", nil); err != nil {
aerakiLog.Errorf("failed to start pprof server")
}
}()

// Only create EnvoyFilters and assign VIP when running as in master mode
if s.args.Master {
Expand Down
4 changes: 3 additions & 1 deletion pkg/model/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ func BuildMetaProtocolRouteName(host string, port int) string {
// it will be overridden if subset named as subsetName in param is not nil
func GetHashPolicy(dr *DestinationRuleWrapper, subsetName string) string {
if subsetName == "" {
return getConsistentHashHeaderName(dr.Spec.TrafficPolicy)
if dr != nil && dr.Spec != nil && dr.Spec.TrafficPolicy != nil {
return getConsistentHashHeaderName(dr.Spec.TrafficPolicy)
}
} else if dr != nil && dr.Spec != nil && dr.Spec.Subsets != nil {
for _, subset := range dr.Spec.Subsets {
if subsetName == subset.GetName() {
Expand Down