Skip to content

Commit

Permalink
Merge pull request #323 from aergoio/bugfix/disable_pprof
Browse files Browse the repository at this point in the history
remove pprof
  • Loading branch information
rabbitprincess authored Nov 25, 2023
2 parents 27d5dc6 + f762612 commit 9bfee26
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 27 deletions.
10 changes: 0 additions & 10 deletions cmd/aergosvr/aergosvr.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package main

import (
"fmt"
"net/http"
_ "net/http/pprof"
"os"

"github.com/aergoio/aergo-lib/log"
Expand Down Expand Up @@ -99,14 +97,6 @@ func rootRun(cmd *cobra.Command, args []string) {
svrlog = log.NewLogger("asvr")
svrlog.Info().Str("revision", gitRevision).Str("branch", gitBranch).Msg("AERGO SVR STARTED")

if cfg.EnableProfile {
svrlog.Info().Msgf("Enable Profiling on localhost: %d", cfg.ProfilePort)
go func() {
err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", cfg.ProfilePort), nil)
svrlog.Info().Err(err).Msg("Run Profile Server")
}()
}

if cfg.EnableTestmode {
svrlog.Warn().Msgf("Running with unsafe test mode. Turn off test mode for production use!")
}
Expand Down
10 changes: 0 additions & 10 deletions cmd/polaris/polaris.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package main

import (
"fmt"
"net/http"
_ "net/http/pprof"
"os"

"github.com/aergoio/aergo-actor/actor"
Expand Down Expand Up @@ -78,14 +76,6 @@ func rootRun(cmd *cobra.Command, args []string) {

p2pkey.InitNodeInfo(&cfg.BaseConfig, cfg.P2P, githash, svrlog)

if cfg.EnableProfile {
svrlog.Info().Msgf("Enable Profiling on localhost: %d", cfg.ProfilePort)
go func() {
err := http.ListenAndServe(fmt.Sprintf("0.0.0.0:%d", cfg.ProfilePort), nil)
svrlog.Info().Err(err).Msg("Run Profile Server")
}()
}

if cfg.EnableTestmode {
svrlog.Warn().Msgf("Running with unsafe test mode. Turn off test mode for production use!")
}
Expand Down
1 change: 0 additions & 1 deletion cmd/polaris/polaris_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
_ "net/http/pprof"
"testing"

"github.com/aergoio/aergo/v2/config"
Expand Down
2 changes: 0 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ func (ctx *ServerContext) GetDefaultBaseConfig() BaseConfig {
return BaseConfig{
DataDir: ctx.ExpandPathEnv("$HOME/data"),
DbType: "badgerdb",
EnableProfile: false,
ProfilePort: 6060,
EnableDump: false,
DumpPort: GetDefaultDumpPort(),
EnableTestmode: false,
Expand Down
4 changes: 0 additions & 4 deletions config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ type Config struct {
type BaseConfig struct {
DataDir string `mapstructure:"datadir" description:"Directory to store datafiles"`
DbType string `mapstructure:"dbtype" description:"db implementation to store data"`
EnableProfile bool `mapstructure:"enableprofile" description:"enable profiling"`
ProfilePort int `mapstructure:"profileport" description:"profile port (default:6060)"`
EnableDump bool `mapstructure:"enabledump" description:"enable dump feature for debugging"`
DumpPort int `mapstructure:"dumpport" description:"dump port (default:7070)"`
EnableTestmode bool `mapstructure:"enabletestmode" description:"enable unsafe test mode"`
Expand Down Expand Up @@ -182,8 +180,6 @@ const tomlConfigFileTemplate = `# aergo TOML Configuration File (https://github.
# base configurations
datadir = "{{.BaseConfig.DataDir}}"
dbtype = "{{.BaseConfig.DbType}}"
enableprofile = {{.BaseConfig.EnableProfile}}
profileport = {{.BaseConfig.ProfilePort}}
enabledump = {{.BaseConfig.EnableDump}}
dumpport = {{.BaseConfig.DumpPort}}
personal = {{.BaseConfig.Personal}}
Expand Down

0 comments on commit 9bfee26

Please sign in to comment.