diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-07-31 02:00:01 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-07-31 02:00:01 -0700 |
| commit | 0d6f45cb464e2dc91dc392447f7af23c744a119d (patch) | |
| tree | 81c50ba85e5ca9462af96a080d3a9432f6cc17f0 /weed/command/server.go | |
| parent | a3290faf17cccc0ed22486e391953afe04dec6b9 (diff) | |
| download | seaweedfs-0d6f45cb464e2dc91dc392447f7af23c744a119d.tar.xz seaweedfs-0d6f45cb464e2dc91dc392447f7af23c744a119d.zip | |
add debug option to generate full goroutine stack dump
Diffstat (limited to 'weed/command/server.go')
| -rw-r--r-- | weed/command/server.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/command/server.go b/weed/command/server.go index 97f117665..83aa5e84c 100644 --- a/weed/command/server.go +++ b/weed/command/server.go @@ -3,6 +3,7 @@ package command import ( "fmt" "github.com/chrislusf/seaweedfs/weed/util/grace" + "net/http" "os" "strings" "time" @@ -16,6 +17,7 @@ import ( type ServerOptions struct { cpuprofile *string memprofile *string + debug *bool v VolumeServerOptions } @@ -78,6 +80,7 @@ var ( func init() { serverOptions.cpuprofile = cmdServer.Flag.String("cpuprofile", "", "cpu profile output file") serverOptions.memprofile = cmdServer.Flag.String("memprofile", "", "memory profile output file") + serverOptions.debug = cmdServer.Flag.Bool("debug", false, "generate full goroutine stack dump http://localhost:6060/debug/pprof/goroutine?debug=2") masterOptions.port = cmdServer.Flag.Int("master.port", 9333, "master server http listen port") masterOptions.metaFolder = cmdServer.Flag.String("master.dir", "", "data directory to store meta data, default to same as -dir specified") @@ -139,6 +142,10 @@ func init() { func runServer(cmd *Command, args []string) bool { + if *serverOptions.debug { + go http.ListenAndServe("localhost:6060", nil) + } + util.LoadConfiguration("security", false) util.LoadConfiguration("master", false) |
