alex2108 / syncthing-tray

trayicon to display status of syncthing
MIT License
57 stars 9 forks source link

v.4 Won't run on Mac #20

Closed SenorLoco closed 8 years ago

SenorLoco commented 8 years ago

I know Mac support wasn't ever officially mentioned but prior to syncthing v0.13.2 I was using syncthing-tray v.3 without any issue, but since upgrading to syncthing v.0.13.2 and syncthing-tray v.4 I've been having issues. Everything is working great on my debian box and would love to use the new version on my Mac. Unfortunately my Go knowledge is very minimal so I'm not sure where the issue is or if it's an easy fix, but I appreciate your time and I'm willing to test anything. Thanks.

`Adams-MacBook-Pro:bin adam$ ./syncthing-tray -target http://127.0.0.1:8080 -api F0d3D34whU4NpBIGx0tINyIuEWantkp3 2016/05/23 14:38:12 main.go:274: Starting Syncthing-Tray 2016/05/23 14:38:12 main.go:275: Connecting to syncthing at http://127.0.0.1:8080 2016/05/23 14:38:12 initialize.go:148: wating for lock 2016/05/23 14:38:12 initialize.go:150: wating for event lock 2016/05/23 14:38:12 initialize.go:162: syncthing restarted at 2016-05-23T07:01:26.238330068-05:00 2016/05/23 14:38:12 initialize.go:205: reading config from syncthing 2016/05/23 14:38:12 initialize.go:257: getting version 2016/05/23 14:38:12 initialize.go:267: displaying version 2016-05-23 14:38:13.022 syncthing-tray[15095:285104] * Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359 2016-05-23 14:38:13.023 syncthing-tray[15095:285104] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2016-05-23 14:38:13.024 syncthing-tray[15095:285104](0 CoreFoundation 0x00007fff9a46b4f2 __exceptionPreprocess + 178 1 libobjc.A.dylib 0x00007fff9839673c objc_exception_throw + 48 2 CoreFoundation 0x00007fff9a4701ca +[NSException raise:format:arguments:] + 106 3 Foundation 0x00007fff8b400856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 4 Foundation 0x00007fff8b385af1 +[NSUndoManager%28NSPrivate%29 _endTopLevelGroupings] + 170 5 AppKit 0x00007fff9453be22 -[NSApplication run] + 844 6 syncthing-tray 0x00000000042d9330 nativeLoop + 128 7 syncthing-tray 0x00000000042d8cea _cgo_46c98963705b_Cfunc_nativeLoop + 26 8 syncthing-tray 0x0000000004065f00 runtime.asmcgocall + 112) 2016-05-23 14:38:13.024 syncthing-tray[15095:285104] * Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359 2016-05-23 14:38:13.025 syncthing-tray[15095:285104] An uncaught exception was raised 2016-05-23 14:38:13.025 syncthing-tray[15095:285104] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread. 2016-05-23 14:38:13.025 syncthing-tray[15095:285104](0 CoreFoundation 0x00007fff9a46b4f2 exceptionPreprocess + 178 1 libobjc.A.dylib 0x00007fff9839673c objc_exception_throw + 48 2 CoreFoundation 0x00007fff9a4701ca +[NSException raise:format:arguments:] + 106 3 Foundation 0x00007fff8b400856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 4 Foundation 0x00007fff8b385af1 +[NSUndoManager%28NSPrivate%29 _endTopLevelGroupings] + 170 5 AppKit 0x00007fff9453bebe -[NSApplication run] + 1000 6 syncthing-tray 0x00000000042d9330 nativeLoop + 128 7 syncthing-tray 0x00000000042d8cea _cgo_46c98963705b_Cfunc_nativeLoop + 26 8 syncthing-tray 0x0000000004065f00 runtime.asmcgocall + 112) 2016-05-23 14:38:13.025 syncthing-tray[15095:285104] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.' * First throw call stack: ( 0 CoreFoundation 0x00007fff9a46b4f2 exceptionPreprocess + 178 1 libobjc.A.dylib 0x00007fff9839673c objc_exception_throw + 48 2 CoreFoundation 0x00007fff9a4701ca +[NSException raise:format:arguments:] + 106 3 Foundation 0x00007fff8b400856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198 4 Foundation 0x00007fff8b385af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170 5 AppKit 0x00007fff9453bebe -[NSApplication run] + 1000 6 syncthing-tray 0x00000000042d9330 nativeLoop + 128 7 syncthing-tray 0x00000000042d8cea _cgo_46c98963705b_Cfunc_nativeLoop + 26 8 syncthing-tray 0x0000000004065f00 runtime.asmcgocall + 112 ) libc++abi.dylib: terminating with uncaught exception of type NSException SIGABRT: abort PC=0x7fff8d75bf06 m=5 signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x42d8cd0, 0xc82004fdf0, 0xc800000000) /usr/local/go/src/runtime/cgocall.go:123 +0x11b fp=0xc82004fdc8 sp=0xc82004fd98 github.com/thomasf/systray._Cfunc_nativeLoop(0x0) github.com/thomasf/systray/_obj/_cgo_gotypes.go:76 +0x45 fp=0xc82004fdf0 sp=0xc82004fdc8 github.com/thomasf/systray.nativeLoop() /Volumes/Storage/Users/adam/GoWork/src/github.com/thomasf/systray/cgo.go:20 +0x18 fp=0xc82004fe00 sp=0xc82004fdf0 github.com/thomasf/systray.Run(0x44c3ee8) /Volumes/Storage/Users/adam/GoWork/src/github.com/thomasf/systray/systray.go:56 +0xa0 fp=0xc82004fe28 sp=0xc82004fe00 main.main() /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:285 +0x64c fp=0xc82004ff50 sp=0xc82004fe28 runtime.main() /usr/local/go/src/runtime/proc.go:188 +0x2b0 fp=0xc82004ffa0 sp=0xc82004ff50 runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc82004ffa8 sp=0xc82004ffa0

goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/local/go/src/runtime/sigqueue.go:116 +0x132 os/signal.loop() /usr/local/go/src/os/signal/signal_unix.go:22 +0x18 created by os/signal.init.1 /usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 6 [select, locked to thread]: runtime.gopark(0x44c4698, 0xc820024728, 0x4419e90, 0x6, 0x18, 0x2) /usr/local/go/src/runtime/proc.go:262 +0x163 runtime.selectgoImpl(0xc820024728, 0x0, 0x18) /usr/local/go/src/runtime/select.go:392 +0xa67 runtime.selectgo(0xc820024728) /usr/local/go/src/runtime/select.go:215 +0x12 runtime.ensureSigM.func1() /usr/local/go/src/runtime/signal1_unix.go:279 +0x32c runtime.goexit() /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 7 [chan receive]: main.main.func1(0xc82005c420) /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:266 +0x36 created by main.main /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:269 +0x383

goroutine 8 [chan receive]: main.rate_reader() /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/rate_reader.go:15 +0xc3 created by main.main /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:277 +0x624

goroutine 9 [semacquire]: sync.runtime_Semacquire(0x4628c2c) /usr/local/go/src/runtime/sema.go:47 +0x26 sync.(*Mutex).Lock(0x4628c28) /usr/local/go/src/sync/mutex.go:83 +0x1c4 main.main_loop() /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:154 +0x23 main.main.func2() /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:280 +0x19 created by main.main /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/main.go:282 +0x63c

goroutine 10 [chan receive]: github.com/thomasf/systray.Run.func1(0x44c3ee8) /Volumes/Storage/Users/adam/GoWork/src/github.com/thomasf/systray/systray.go:52 +0x38 created by github.com/thomasf/systray.Run /Volumes/Storage/Users/adam/GoWork/src/github.com/thomasf/systray/systray.go:54 +0x9b

goroutine 34 [semacquire]: sync.runtime_Semacquire(0x4628c3c) /usr/local/go/src/runtime/sema.go:47 +0x26 sync.(*Mutex).Lock(0x4628c38) /usr/local/go/src/sync/mutex.go:83 +0x1c4 main.get_config(0x0, 0x0) /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/initialize.go:268 +0xc9d main.initializeLocked() /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/initialize.go:166 +0xba created by main.initialize /Volumes/Storage/Users/adam/GoWork/src/github.com/alex2108/syncthing-tray/initialize.go:152 +0x1c0

goroutine 36 [IO wait]: net.runtime_pollWait(0x4ea1000, 0x72, 0xc82026c000) /usr/local/go/src/runtime/netpoll.go:160 +0x60 net.(_pollDesc).Wait(0xc8202620d0, 0x72, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a net.(_pollDesc).WaitRead(0xc8202620d0, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36 net.(_netFD).Read(0xc820262070, 0xc82026c000, 0x1000, 0x1000, 0x0, 0x4d00050, 0xc820010170) /usr/local/go/src/net/fd_unix.go:250 +0x23a net.(_conn).Read(0xc82026a000, 0xc82026c000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:172 +0xe4 net/http.noteEOFReader.Read(0x4ea10c0, 0xc82026a000, 0xc820246138, 0xc82026c000, 0x1000, 0x1000, 0x400fa33, 0x0, 0x0) /usr/local/go/src/net/http/transport.go:1687 +0x67 net/http.(_noteEOFReader).Read(0xc820252100, 0xc82026c000, 0x1000, 0x1000, 0xc820274d1d, 0x0, 0x0)

:284 +0xd0 bufio.(_Reader).fill(0xc820264300) /usr/local/go/src/bufio/bufio.go:97 +0x1e9 bufio.(_Reader).Peek(0xc820264300, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/bufio/bufio.go:132 +0xcc net/http.(_persistConn).readLoop(0xc8202460d0) /usr/local/go/src/net/http/transport.go:1073 +0x177 created by net/http.(*Transport).dialConn /usr/local/go/src/net/http/transport.go:857 +0x10a6 goroutine 37 [select]: net/http.(_persistConn).writeLoop(0xc8202460d0) /usr/local/go/src/net/http/transport.go:1277 +0x472 created by net/http.(_Transport).dialConn /usr/local/go/src/net/http/transport.go:858 +0x10cb goroutine 51 [IO wait]: net.runtime_pollWait(0x4ea0f40, 0x72, 0xc8202aa000) /usr/local/go/src/runtime/netpoll.go:160 +0x60 net.(_pollDesc).Wait(0xc8202861b0, 0x72, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a net.(_pollDesc).WaitRead(0xc8202861b0, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36 net.(_netFD).Read(0xc820286150, 0xc8202aa000, 0x1000, 0x1000, 0x0, 0x4d00050, 0xc820010170) /usr/local/go/src/net/fd_unix.go:250 +0x23a net.(_conn).Read(0xc82028c008, 0xc8202aa000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:172 +0xe4 net/http.noteEOFReader.Read(0x4ea10c0, 0xc82028c008, 0xc820294138, 0xc8202aa000, 0x1000, 0x1000, 0x400fa33, 0x0, 0x0) /usr/local/go/src/net/http/transport.go:1687 +0x67 net/http.(_noteEOFReader).Read(0xc8202823c0, 0xc8202aa000, 0x1000, 0x1000, 0xc820275d1d, 0x0, 0x0) :284 +0xd0 bufio.(_Reader).fill(0xc82026e360) /usr/local/go/src/bufio/bufio.go:97 +0x1e9 bufio.(_Reader).Peek(0xc82026e360, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/bufio/bufio.go:132 +0xcc net/http.(_persistConn).readLoop(0xc8202940d0) /usr/local/go/src/net/http/transport.go:1073 +0x177 created by net/http.(*Transport).dialConn /usr/local/go/src/net/http/transport.go:857 +0x10a6 goroutine 52 [select]: net/http.(_persistConn).writeLoop(0xc8202940d0) /usr/local/go/src/net/http/transport.go:1277 +0x472 created by net/http.(_Transport).dialConn /usr/local/go/src/net/http/transport.go:858 +0x10cb goroutine 39 [IO wait]: net.runtime_pollWait(0x4ea0e80, 0x72, 0xc8202bb000) /usr/local/go/src/runtime/netpoll.go:160 +0x60 net.(_pollDesc).Wait(0xc820262450, 0x72, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a net.(_pollDesc).WaitRead(0xc820262450, 0x0, 0x0) /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36 net.(_netFD).Read(0xc8202623f0, 0xc8202bb000, 0x1000, 0x1000, 0x0, 0x4d00050, 0xc820010170) /usr/local/go/src/net/fd_unix.go:250 +0x23a net.(_conn).Read(0xc82026a010, 0xc8202bb000, 0x1000, 0x1000, 0x0, 0x0, 0x0) /usr/local/go/src/net/net.go:172 +0xe4 net/http.noteEOFReader.Read(0x4ea10c0, 0xc82026a010, 0xc820246888, 0xc8202bb000, 0x1000, 0x1000, 0x400fa33, 0x0, 0x0) /usr/local/go/src/net/http/transport.go:1687 +0x67 net/http.(_noteEOFReader).Read(0xc820253380, 0xc8202bb000, 0x1000, 0x1000, 0xc820277d1d, 0x0, 0x0) :284 +0xd0 bufio.(_Reader).fill(0xc820264780) /usr/local/go/src/bufio/bufio.go:97 +0x1e9 bufio.(_Reader).Peek(0xc820264780, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0) /usr/local/go/src/bufio/bufio.go:132 +0xcc net/http.(_persistConn).readLoop(0xc820246820) /usr/local/go/src/net/http/transport.go:1073 +0x177 created by net/http.(*Transport).dialConn /usr/local/go/src/net/http/transport.go:857 +0x10a6 goroutine 40 [select]: net/http.(_persistConn).writeLoop(0xc820246820) /usr/local/go/src/net/http/transport.go:1277 +0x472 created by net/http.(_Transport).dialConn /usr/local/go/src/net/http/transport.go:858 +0x10cb rax 0x0 rbx 0x6 rcx 0x700000208518 rdx 0x0 rdi 0x1603 rsi 0x6 rbp 0x700000208540 rsp 0x700000208518 r8 0x3 r9 0x7fff893bfa7c r10 0x8000000 r11 0x206 r12 0x7000002086a0 r13 0x58076d0 r14 0x70000020a000 r15 0x700000208580 rip 0x7fff8d75bf06 rflags 0x206 cs 0x7 fs 0x0 gs 0x0 `
alex2108 commented 8 years ago

You could try replacing github.com/thomasf/systray with github.com/getlantern/systray in main.go and initialize.go as the fork I'm using is just easier to use for me on windows but was not updated for a while, maybe this is fixed upstream.

Otherwise I have no idea what is going on there, looks like something in cgo which is used in systray library...

SenorLoco commented 8 years ago

Still no luck, but thanks for the suggestion.

xor-gate commented 8 years ago

I'm the maintainer of the xor-gate/syncthing-mac OS X DMG package. But got exact the same error as SenorLoco already posted. To bad it is broken on OS X now.

alex2108 commented 8 years ago

could you try running the example from here https://github.com/getlantern/systray (and try clicking the different options in the menu as they change the titles which seems to be the problem since the last log line is from before that)

xor-gate commented 8 years ago

The example seems to run fine with no crashes.

xor-gate commented 8 years ago

I have changed the dependency from github.com/thomasf/systray with github.com/getlantern/systray which also gets killed instantly (syncthing 0.13.x):

I also tried with passing the API key but without success.

Jerrys-MacBook-Pro:syncthing-tray jerry$ ./syncthing-tray
2016/05/30 13:42:53 main.go:269: Starting Syncthing-Tray
2016/05/30 13:42:53 main.go:270: Connecting to syncthing at http://localhost:8384
2016/05/30 13:42:53 initialize.go:148: wating for lock
2016/05/30 13:42:53 initialize.go:150: wating for event lock
2016/05/30 13:42:53 initialize.go:135: invalid character 'C' looking for beginning of value
2016/05/30 13:42:53 initialize.go:188: invalid character 'C' looking for beginning of value
2016/05/30 13:42:53 initialize.go:189: error getting syncthing config -> retry in 5s
2016-05-30 13:42:53.549 syncthing-tray[42318:2452512] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-05-30 13:42:53.550 syncthing-tray[42318:2452512] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-05-30 13:42:53.550 syncthing-tray[42318:2452512] (
    0   CoreFoundation                      0x00007fff8bef04f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9d6c7f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8bef51ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9b97d856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9b902af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b014e22 -[NSApplication run] + 844
    6   syncthing-tray                      0x00000000042d9b90 nativeLoop + 128
    7   syncthing-tray                      0x00000000042d955a _cgo_8c6479959095_Cfunc_nativeLoop + 26
    8   syncthing-tray                      0x0000000004065b90 runtime.asmcgocall + 112
)
2016-05-30 13:42:53.551 syncthing-tray[42318:2452512] *** Assertion failure in +[NSUndoManager _endTopLevelGroupings], /Library/Caches/com.apple.xbs/Sources/Foundation/Foundation-1259/Misc.subproj/NSUndoManager.m:359
2016-05-30 13:42:53.551 syncthing-tray[42318:2452512] An uncaught exception was raised
2016-05-30 13:42:53.551 syncthing-tray[42318:2452512] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.
2016-05-30 13:42:53.551 syncthing-tray[42318:2452512] (
    0   CoreFoundation                      0x00007fff8bef04f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9d6c7f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8bef51ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9b97d856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9b902af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b014ebe -[NSApplication run] + 1000
    6   syncthing-tray                      0x00000000042d9b90 nativeLoop + 128
    7   syncthing-tray                      0x00000000042d955a _cgo_8c6479959095_Cfunc_nativeLoop + 26
    8   syncthing-tray                      0x0000000004065b90 runtime.asmcgocall + 112
)
2016-05-30 13:42:53.551 syncthing-tray[42318:2452512] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '+[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff8bef04f2 __exceptionPreprocess + 178
    1   libobjc.A.dylib                     0x00007fff9d6c7f7e objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff8bef51ca +[NSException raise:format:arguments:] + 106
    3   Foundation                          0x00007fff9b97d856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
    4   Foundation                          0x00007fff9b902af1 +[NSUndoManager(NSPrivate) _endTopLevelGroupings] + 170
    5   AppKit                              0x00007fff8b014ebe -[NSApplication run] + 1000
    6   syncthing-tray                      0x00000000042d9b90 nativeLoop + 128
    7   syncthing-tray                      0x00000000042d955a _cgo_8c6479959095_Cfunc_nativeLoop + 26
    8   syncthing-tray                      0x0000000004065b90 runtime.asmcgocall + 112
)
libc++abi.dylib: terminating with uncaught exception of type NSException
SIGABRT: abort
PC=0x7fff8f999f06 m=5
signal arrived during cgo execution

goroutine 1 [syscall, locked to thread]:
runtime.cgocall(0x42d9540, 0xc820049df0, 0xc800000000)
    /usr/local/go/src/runtime/cgocall.go:123 +0x11b fp=0xc820049dc8 sp=0xc820049d98
github.com/getlantern/systray._Cfunc_nativeLoop(0x0)
    github.com/getlantern/systray/_obj/_cgo_gotypes.go:76 +0x45 fp=0xc820049df0 sp=0xc820049dc8
github.com/getlantern/systray.nativeLoop()
    /Users/jerry/Go/src/github.com/getlantern/systray/systray_nonwindows.go:19 +0x18 fp=0xc820049e00 sp=0xc820049df0
github.com/getlantern/systray.Run(0x44c5a00)
    /Users/jerry/Go/src/github.com/getlantern/systray/systray.go:56 +0xa0 fp=0xc820049e28 sp=0xc820049e00
main.main()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:281 +0x664 fp=0xc820049f50 sp=0xc820049e28
runtime.main()
    /usr/local/go/src/runtime/proc.go:188 +0x2b0 fp=0xc820049fa0 sp=0xc820049f50
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1 fp=0xc820049fa8 sp=0xc820049fa0

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
    /usr/local/go/src/runtime/sigqueue.go:116 +0x132
os/signal.loop()
    /usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
    /usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 6 [select, locked to thread]:
runtime.gopark(0x44c61b0, 0xc820026728, 0x441b3e8, 0x6, 0x18, 0x2)
    /usr/local/go/src/runtime/proc.go:262 +0x163
runtime.selectgoImpl(0xc820026728, 0x0, 0x18)
    /usr/local/go/src/runtime/select.go:392 +0xa67
runtime.selectgo(0xc820026728)
    /usr/local/go/src/runtime/select.go:215 +0x12
runtime.ensureSigM.func1()
    /usr/local/go/src/runtime/signal1_unix.go:279 +0x32c
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1998 +0x1

goroutine 7 [chan receive]:
main.main.func1(0xc820016480)
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:261 +0x36
created by main.main
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:264 +0x383

goroutine 8 [chan receive]:
main.rate_reader()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/rate_reader.go:15 +0xc3
created by main.main
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:272 +0x624

goroutine 9 [chan receive]:
main.eventProcessor()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:111 +0x82
created by main.main
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:273 +0x63c

goroutine 10 [semacquire]:
sync.runtime_Semacquire(0x462ac1c)
    /usr/local/go/src/runtime/sema.go:47 +0x26
sync.(*Mutex).Lock(0x462ac18)
    /usr/local/go/src/sync/mutex.go:83 +0x1c4
main.main_loop()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:149 +0x23
main.main.func2()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:276 +0x19
created by main.main
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/main.go:278 +0x654

goroutine 11 [chan receive]:
github.com/getlantern/systray.Run.func1(0x44c5a00)
    /Users/jerry/Go/src/github.com/getlantern/systray/systray.go:52 +0x38
created by github.com/getlantern/systray.Run
    /Users/jerry/Go/src/github.com/getlantern/systray/systray.go:54 +0x9b

goroutine 34 [semacquire]:
sync.runtime_Semacquire(0x462ac2c)
    /usr/local/go/src/runtime/sema.go:47 +0x26
sync.(*Mutex).Lock(0x462ac28)
    /usr/local/go/src/sync/mutex.go:83 +0x1c4
main.initializeLocked()
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/initialize.go:192 +0x349
created by main.initialize
    /Users/jerry/Go/src/github.com/alex2108/syncthing-tray/initialize.go:152 +0x1c0

goroutine 37 [IO wait]:
net.runtime_pollWait(0x4ea4fd8, 0x72, 0xc820270000)
    /usr/local/go/src/runtime/netpoll.go:160 +0x60
net.(*pollDesc).Wait(0xc820262140, 0x72, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:73 +0x3a
net.(*pollDesc).WaitRead(0xc820262140, 0x0, 0x0)
    /usr/local/go/src/net/fd_poll_runtime.go:78 +0x36
net.(*netFD).Read(0xc8202620e0, 0xc820270000, 0x1000, 0x1000, 0x0, 0x4d00050, 0xc82000a048)
    /usr/local/go/src/net/fd_unix.go:250 +0x23a
net.(*conn).Read(0xc82026e010, 0xc820270000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
    /usr/local/go/src/net/net.go:172 +0xe4
net/http.noteEOFReader.Read(0x4ea5110, 0xc82026e010, 0xc820246138, 0xc820270000, 0x1000, 0x1000, 0x400f6c3, 0x0, 0x0)
    /usr/local/go/src/net/http/transport.go:1687 +0x67
net/http.(*noteEOFReader).Read(0xc8202481c0, 0xc820270000, 0x1000, 0x1000, 0xc820035d1d, 0x0, 0x0)
    <autogenerated>:284 +0xd0
bufio.(*Reader).fill(0xc8202663c0)
    /usr/local/go/src/bufio/bufio.go:97 +0x1e9
bufio.(*Reader).Peek(0xc8202663c0, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/bufio/bufio.go:132 +0xcc
net/http.(*persistConn).readLoop(0xc8202460d0)
    /usr/local/go/src/net/http/transport.go:1073 +0x177
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:857 +0x10a6

goroutine 38 [select]:
net/http.(*persistConn).writeLoop(0xc8202460d0)
    /usr/local/go/src/net/http/transport.go:1277 +0x472
created by net/http.(*Transport).dialConn
    /usr/local/go/src/net/http/transport.go:858 +0x10cb

rax    0x0
rbx    0x6
rcx    0x700000208518
rdx    0x0
rdi    0x1603
rsi    0x6
rbp    0x700000208540
rsp    0x700000208518
r8     0x3
r9     0x7fff8e563a7c
r10    0x8000000
r11    0x206
r12    0x7000002086a0
r13    0x4f0b1e0
r14    0x70000020a000
r15    0x700000208580
rip    0x7fff8f999f06
rflags 0x206
cs     0x7
fs     0x0
gs     0x0
alex2108 commented 8 years ago

I think I got an idea what it could be, in the example main just starts systray.Run() in my program something in systray could be in theory called by another goroutine before systray.Run() is called.

You could try moving this whole part

log.Println("Starting Syncthing-Tray")
    log.Println("Connecting to syncthing at", config.Url)
    trayMutex.Lock()
    go rate_reader()
    go eventProcessor()
    go func() {
        initialize()
        main_loop()

    }()

inside setupTray() (at the beginning I would suggest)

alex2108 commented 8 years ago

ok, actually it should not make any difference since the mutex should block relevant calls :/ (you always notice stuff after pressing "Comment"...)

Another thing you can try is adding more prints to find where it exactly happens and comment out those parts (around anything with SetTitle or systray.SetIcon) maybe there is a problem with some special characters (upload/download arrows?)

xor-gate commented 8 years ago

I tried moving it but it doesn't compile, probably due to the systray.Run not finding the golang functions. Due to two same depencies, having main.go and initialize.go pointing to two different implementation. My bad.

alex2108 commented 8 years ago

from the example:

    // Should be called at the very beginning of main().
    systray.Run(onReady)

maybe this has to be listened to on OSX ;)

-> put everything from main to the beginning of setupTray so that main is just

func main() {
    systray.Run(setupTray)
}
xor-gate commented 8 years ago

Yeah, I'm currently investigating and get already an icon and menu without getting killed. Need to see if I get it working completely. Almost there (hopefully).

xor-gate commented 8 years ago

I have pushed my changes (and source-code formatting) to get it running without crash, but no connection can be made: https://github.com/xor-gate/syncthing-tray/tree/osx-fixes-for-issue-20

2016/05/30 14:23:32 wating for lock
2016/05/30 14:23:32 wating for event lock
2016/05/30 14:23:32 ERROR: Get /rest/system/status: unsupported protocol scheme ""
2016/05/30 14:23:32 Get /rest/system/status: unsupported protocol scheme ""
2016/05/30 14:23:32 Get /rest/system/status: unsupported protocol scheme ""
2016/05/30 14:23:32 error getting syncthing config -> retry in 5s

More investigation is needed, and probably the mutex should be correctly placed (removed it now). With current source i'm not happy how the mutex are placed. Because a mutex is set, then a function is entered and then it is released. This makes changing and reviewing a pain.

alex2108 commented 8 years ago

This is starting to make sense, https://github.com/cratonica/trayhost (which is in the credits of https://github.com/getlantern/systray and I used a fork of it with more features before) has a runtime.LockOSThread() at the beginning of the example, systray has this in the run function so that needs to be called at the beginning of main (before starting additional goroutines I assume).

The error message above already says something like that 2016-05-30 13:42:53.550 syncthing-tray[42318:2452512] +[NSUndoManager(NSInternal) _endTopLevelGroupings] is only safe to invoke on the main thread.

xor-gate commented 8 years ago

Yeah the error was clear, but there was to much detailed info to extract the point which makes sense.

alex2108 commented 8 years ago

your change will not work because systray.Run(setupTray) blocks and the stuff below is never executed (thus url being "")

xor-gate commented 8 years ago

Okay, I understand. Probably it should be a good idea to run your code through gofmt -s -w <file>.go. Because currently it is misplaced all over without proper consistency.

alex2108 commented 8 years ago

yeah I did not do that in a while, that is definately a good idea

xor-gate commented 8 years ago

Will there be any progress soon for a new version? I would like to create a new version for distribution on OS X (which supports syncthing 0.13.x).

alex2108 commented 8 years ago

It should now work on OS X (I hope, I can't test...). I will not make a new version for that as for the Windows and Linux releases there is nothing new, just use the latest master.

Please report if this works now so I can close the issue.

SenorLoco commented 8 years ago

Running and working on my end now with just 1 issue. The icon size is off. In this screenshot syncthing-tray is on the left.

xor-gate commented 8 years ago

Yeah the icon size is broken now (and pixelated on retina screens). But hey, it works and I have created a new packaged release: https://github.com/xor-gate/syncthing-mac/releases/tag/v0.13.5. @alex2108 probably this issue can be closed now.

SenorLoco commented 8 years ago

I was able to get the icon size better by changing the size in make-icons.sh to 18x18.

xor-gate commented 8 years ago

@SenorLoco see PR #24. Now we should support both retina and non-retina screens. Took me some time to figure out. But apple can load based on filename for both screens, how cool.

alex2108 commented 8 years ago

should be fixed by 3aba0a7f276eb7f0a1d0184294005205cae03039 now, thx @xor-gate