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

Incorrect command string passed to process manager #35

Open
timfallmk opened this issue Jan 25, 2018 · 3 comments
Open

Incorrect command string passed to process manager #35

timfallmk opened this issue Jan 25, 2018 · 3 comments

Comments

@timfallmk
Copy link

When spawning the child process, the cmd that's reported to the system (accessible via ps and top etc.) truncates the process name.

For example:
A child process that's command --flag verb is reported as --flag verb

ps -p <pid>
  PID TTY           TIME CMD
 6483 ??         0:01.78 --flag verb

I suspect this is related to #33 and #34

@sevlyar
Copy link
Owner

sevlyar commented Mar 5, 2018

@timfallmk It can be caused by an incorrect Context.Args value. A value of Context.Args field is passed to os.StartProcess without any modifications exclude a case when the value is nil. Please see os.StartProcess, os.Args for the reference.
Could you provide the code and info about OS and environment (go env && uname -a).

@timfallmk
Copy link
Author

Go env:

go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/timfall/Library/Caches/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/timfall/Code/go"
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rs/97ytdh4946n_7g59d2x8jh2h0000gn/T/go-build122390918=/tmp/go-build -gno-record-gcc-switches -fno-common"
Darwin 17.5.0 Darwin Kernel Version 17.5.0: Sun Feb 11 23:54:24 PST 2018; root:xnu-4570.50.279~25/RELEASE_X86_64 x86_64

If the expected behavior is as you outlined, then this is a bug.

@sevlyar
Copy link
Owner

sevlyar commented Mar 6, 2018

I checked it on examples/gd-simple and i can't reproduce the bug.

➜  examples git:(master) ✗ gd-simple
➜  examples git:(master) ✗ ps -eafwA | grep sample
  501 38137     1   0 11:24   ??         0:00.01 [go-daemon sample]

When i comment line no 23 of the code:

➜  examples git:(master) ✗ gd-simple
➜  examples git:(master) ✗ ps -eafwA | grep gd-simple
  501 37910     1   0 11:22   ??         0:00.01 gd-simple
➜  examples git:(master) ✗ kill `cat pid`
➜  examples git:(master) ✗ gd-simple -a -b 
➜  examples git:(master) ✗ ps -eafwA | grep gd-simple
  501 37999     1   0 11:23   ??         0:00.01 gd-simple -a -b

Could you provide a reduced example of code and steps to reproduce the bug. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants