go-daemon icon indicating copy to clipboard operation
go-daemon copied to clipboard

Failed run sample on Mac Darwin (Kernel Version 16.X)

Open vus520 opened this issue 7 years ago • 9 comments

ALL PRETTY GOOD on linux.

$ uname -a
Darwin shuhaideMacBook-Pro.local 16.5.0 Darwin Kernel Version 16.5.0: Fri Mar  3 16:52:33 PST 2017; root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64

$ git log -n 1
commit 1ae26ef5036ad04968706917222a23c535673d8c
Author: Sergey Yarmonov <[email protected]>
Date:   Thu May 18 18:12:20 2017 +0700

    Update README

$ go build

$ ./sample -s
[1]    57268 killed     ./sample -s

$ ./sample
[1]    57278 killed     ./sample

$ ./sample -s stop
[1]    57288 killed     ./sample -s stop

$ ./sample -s reload
[1]    57299 killed     ./sample -s reload

vus520 avatar May 22 '17 14:05 vus520

I don't understand you, please explain how you tested the sample?

I tested the same commit and i think all works proper:

➜  go-daemon git:(master) ✗ uname -a
Darwin Morpheus 15.6.0 Darwin Kernel Version 15.6.0: Fri Feb 17 10:21:18 PST 2017; root:xnu-3248.60.11.4.1~1/RELEASE_X86_64 x86_64
➜  go-daemon git:(master) ✗ cd sample 
➜  sample git:(master) ✗ go build
➜  sample git:(master) ✗ ./sample -s stop
2017/05/23 10:03:34 Unable send signal to the daemon: open pid: no such file or directory
➜  sample git:(master) ✗ ./sample        
➜  sample git:(master) ✗ ls
log       pid       sample    sample.go
➜  sample git:(master) ✗ tail -f log &
[1] 30424
2017/05/23 10:03:38 - - - - - - - - - - - - - - -                                                                                                                                                                                   
2017/05/23 10:03:38 daemon started
➜  sample git:(master) ✗ ./sample -s reload
2017/05/23 10:04:08 configuration reloaded
➜  sample git:(master) ✗ ./sample -s stop
2017/05/23 10:04:33 terminating...
2017/05/23 10:04:33 daemon terminated
➜  sample git:(master) ✗ ls
log       sample    sample.go
➜  sample git:(master) ✗ fg
[1]  + 30424 running    tail -f log

Remarks:

  • ./sample -s ... command prints a message only if an error happens, it produces no output in a different case;
  • tail -f log command pipes the daemon's log to the console in my tests.

sevlyar avatar May 23 '17 03:05 sevlyar

My os version "Darwin Kernel Version 16.5.0"

run ./sample on Darwin after go build, Nothing generated, No PID file NO log file. output is '[1] 57268 killed'

vus520 avatar May 23 '17 03:05 vus520

It looks really strange. @vus520 could you give me output of go version && go env command? Thank you.

sevlyar avatar Jun 04 '17 05:06 sevlyar

@sevlyar

$ go version && go env
go version go1.7.4 darwin/amd64
GOARCH="amd64"
GOBIN="/wwwroot/gopath//pkg"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/wwwroot/gopath/"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.4/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.4/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/fm/29zg12712ql3y0l0j3t9_mkw0000gn/T/go-build853998416=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

vus520 avatar Jun 05 '17 02:06 vus520

I updated my OSX Kernel Version up to 16.6.0 and can not reproduce this behavior.

sevlyar avatar Jun 27 '17 02:06 sevlyar

@sevlyar I get this as well.

Darwin Tims-MacBook-Pro-15.local 17.4.0 Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64 x86_64
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/timfall/Code/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/rs/97ytdh4946n_7g59d2x8jh2h0000gn/T/go-build272996179=/tmp/go-build -gno-record-gcc-switches -fno-common"
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"
go version go1.9.2 darwin/amd64

A pid and log file are written, but the pid file is blank.

timfallmk avatar Jan 25 '18 20:01 timfallmk

Nevermind, I figured it out.

timfallmk avatar Jan 25 '18 21:01 timfallmk

Nevermind, I figured it out.

How did you solve the issue?

ademenev avatar Apr 30 '20 04:04 ademenev

@ademenev its been a long time since I commented so I don’t remember the problem or context, but I switched to using a fork that fixes macOS issues https://github.com/timfallmk/go-daemon

timfallmk avatar Apr 30 '20 07:04 timfallmk