diff --git a/pkg/ipc/ipc.pb.go b/pkg/ipc/ipc.pb.go index 5ac7bf74..95697bac 100644 --- a/pkg/ipc/ipc.pb.go +++ b/pkg/ipc/ipc.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.11 -// protoc v6.33.2 +// protoc v6.33.4 // source: ipc.proto package ipc diff --git a/pkg/ipc/ipc_grpc.pb.go b/pkg/ipc/ipc_grpc.pb.go index 54f0adb6..9256d69d 100644 --- a/pkg/ipc/ipc_grpc.pb.go +++ b/pkg/ipc/ipc_grpc.pb.go @@ -15,7 +15,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.6.0 -// - protoc v6.33.2 +// - protoc v6.33.4 // source: ipc.proto package ipc diff --git a/pkg/service/debug.go b/pkg/service/debug.go index 3c331530..9cfb6346 100644 --- a/pkg/service/debug.go +++ b/pkg/service/debug.go @@ -21,10 +21,11 @@ import ( "strconv" "strings" - "github.com/livekit/ingress/pkg/errors" "github.com/livekit/protocol/logger" "github.com/livekit/protocol/pprof" "github.com/livekit/psrpc" + + "github.com/livekit/ingress/pkg/errors" ) const ( @@ -80,14 +81,22 @@ func (s *Service) handlePProf(w http.ResponseWriter, r *http.Request) { var err error var b []byte - timeout, _ := strconv.Atoi(r.URL.Query().Get("timeout")) - debug, _ := strconv.Atoi(r.URL.Query().Get("debug")) + timeout, err := strconv.ParseInt(r.URL.Query().Get("timeout"), 10, 32) + if err != nil { + http.Error(w, "malformed timeout", http.StatusBadRequest) + return + } + debug, err := strconv.ParseInt(r.URL.Query().Get("debug"), 10, 32) + if err != nil { + http.Error(w, "malformed debug", http.StatusBadRequest) + return + } pathElements := strings.Split(r.URL.Path, "/") switch len(pathElements) { case 3: // profile main service - b, err = pprof.GetProfileData(context.Background(), pathElements[2], timeout, debug) + b, err = pprof.GetProfileData(context.Background(), pathElements[2], int(timeout), int(debug)) case 4: resourceID := pathElements[2] @@ -97,7 +106,7 @@ func (s *Service) handlePProf(w http.ResponseWriter, r *http.Request) { return } - b, err = api.GetProfileData(context.Background(), pathElements[3], timeout, debug) + b, err = api.GetProfileData(context.Background(), pathElements[3], int32(timeout), int32(debug)) if err != nil { return } diff --git a/pkg/service/process_manager.go b/pkg/service/process_manager.go index b00ede51..c683c7b4 100644 --- a/pkg/service/process_manager.go +++ b/pkg/service/process_manager.go @@ -297,7 +297,7 @@ func (p *process) WHIPRTCConnectionNotify(ctx context.Context, req *rpc.WHIPRTCC return &google_protobuf2.Empty{}, nil } -func (p *process) GetProfileData(ctx context.Context, profileName string, timeout int, debug int) (b []byte, err error) { +func (p *process) GetProfileData(ctx context.Context, profileName string, timeout int32, debug int32) (b []byte, err error) { grpcClient := p.grpcClient.Load() if grpcClient == nil { return nil, errors.ErrIngressNotFound diff --git a/pkg/service/service.go b/pkg/service/service.go index 7efd2622..80025b1b 100644 --- a/pkg/service/service.go +++ b/pkg/service/service.go @@ -562,8 +562,8 @@ type localSessionAPI struct { sessionCloser } -func (a *localSessionAPI) GetProfileData(ctx context.Context, profileName string, timeout int, debug int) (b []byte, err error) { - return pprof.GetProfileData(ctx, profileName, timeout, debug) +func (a *localSessionAPI) GetProfileData(ctx context.Context, profileName string, timeout int32, debug int32) (b []byte, err error) { + return pprof.GetProfileData(ctx, profileName, int(timeout), int(debug)) } func (a *localSessionAPI) GetPipelineDot(ctx context.Context) (string, error) { diff --git a/pkg/types/session_api.go b/pkg/types/session_api.go index 93be8bd8..fe487723 100644 --- a/pkg/types/session_api.go +++ b/pkg/types/session_api.go @@ -22,7 +22,7 @@ type SessionAPI interface { MediaStatsUpdater MediaStatGatherer - GetProfileData(ctx context.Context, profileName string, timeout int, debug int) (b []byte, err error) + GetProfileData(ctx context.Context, profileName string, timeout int32, debug int32) (b []byte, err error) GetPipelineDot(ctx context.Context) (string, error) CloseSession(ctx context.Context) }