changkun / midgard

⛰️ Universal clipboard sharing service (supports macOS/Linux/Windows/iOS)
https://changkun.de/s/midgard
GNU General Public License v3.0
210 stars 18 forks source link

Clipboard monitoring may stop working (?) #12

Closed changkun closed 2 years ago

changkun commented 3 years ago

The problem can occur after a very very long time (probably a year?), not sure why, but here is a stack trace:

  thread #22, name = 'mg', stop reason = signal SIGSTOP
    frame #0: 0x00007f781bc3eaff libc.so.6`__poll + 79
    frame #1: 0x00007f781bb0ac1a libxcb.so.1`___lldb_unnamed_symbol7$$libxcb.so.1 + 154
    frame #2: 0x00007f781bb0c90a libxcb.so.1`xcb_wait_for_event + 74
    frame #3: 0x00007f781bd7cc08 libX11.so.6`_XReadEvents + 376
    frame #4: 0x00007f781bd6b758 libX11.so.6`XNextEvent + 248
    frame #5: 0x0000000000c0a6cf mg`clipboard_read(typ=<unavailable>, buf=0x000000c00026e028) at clipboard_linux.c:199:9
    frame #6: 0x0000000000c0a0af mg`_cgo_bf56599c8496_Cfunc_clipboard_read(v=0x000000c0004c8da8) at cgo-gcc-prolog:53:11
    frame #7: 0x000000000046bf70 mg`runtime.asmcgocall.abi0 at asm_amd64.s:765
    frame #8: 0x000000000040eb09 mg`runtime.notewakeup at lock_futex.go:145
  thread #23, name = 'mg', stop reason = signal SIGSTOP
    frame #0: 0x000000000046e083 mg`runtime.futex.abi0 at sys_linux_amd64.s:520
    frame #1: 0x0000000000434c36 mg`runtime.futexsleep at os_linux.go:44
    frame #2: 0x000000000040ec07 mg`runtime.notesleep at lock_futex.go:160
    frame #3: 0x000000000043e0ca mg`runtime.mPark at proc.go:1441
    frame #4: 0x000000000043f618 mg`runtime.stopm at proc.go:2408
    frame #5: 0x0000000000440ae5 mg`runtime.findrunnable at proc.go:2984
    frame #6: 0x0000000000441a19 mg`runtime.schedule at proc.go:3367
    frame #7: 0x0000000000441f6d mg`runtime.park_m at proc.go:3516
    frame #8: 0x000000000046a043 mg`runtime.mcall at asm_amd64.s:307
  thread #24, name = 'mg', stop reason = signal SIGSTOP
    frame #0: 0x000000000046e083 mg`runtime.futex.abi0 at sys_linux_amd64.s:520
    frame #1: 0x0000000000434c36 mg`runtime.futexsleep at os_linux.go:44
    frame #2: 0x000000000040ec07 mg`runtime.notesleep at lock_futex.go:160
    frame #3: 0x000000000043e0ca mg`runtime.mPark at proc.go:1441
    frame #4: 0x000000000043f618 mg`runtime.stopm at proc.go:2408
    frame #5: 0x0000000000440ae5 mg`runtime.findrunnable at proc.go:2984
    frame #6: 0x0000000000441a19 mg`runtime.schedule at proc.go:3367
    frame #7: 0x0000000000441f6d mg`runtime.park_m at proc.go:3516
    frame #8: 0x000000000046a043 mg`runtime.mcall at asm_amd64.s:307
(lldb) thread select 22
* thread #22, name = 'mg', stop reason = signal SIGSTOP
    frame #0: 0x00007f781bc3eaff libc.so.6`__poll + 79
libc.so.6`__poll:
->  0x7f781bc3eaff <+79>: cmpq   $-0x1000, %rax            ; imm = 0xF000
    0x7f781bc3eb05 <+85>: ja     0x7f781bc3eb32            ; <+130>
    0x7f781bc3eb07 <+87>: movl   %r8d, %edi
    0x7f781bc3eb0a <+90>: movl   %eax, 0x8(%rsp)
(lldb) up
frame #1: 0x00007f781bb0ac1a libxcb.so.1`___lldb_unnamed_symbol7$$libxcb.so.1 + 154
libxcb.so.1`___lldb_unnamed_symbol7$$libxcb.so.1:
->  0x7f781bb0ac1a <+154>: movl   %eax, %r12d
    0x7f781bb0ac1d <+157>: testl  %eax, %eax
    0x7f781bb0ac1f <+159>: js     0x7f781bb0ae20            ; <+672>
    0x7f781bb0ac25 <+165>: movswl 0xc(%rsp), %eax
(lldb) up
frame #2: 0x00007f781bb0c90a libxcb.so.1`xcb_wait_for_event + 74
libxcb.so.1`xcb_wait_for_event:
->  0x7f781bb0c90a <+74>: testl  %eax, %eax
    0x7f781bb0c90c <+76>: je     0x7f781bb0c960            ; <+160>
    0x7f781bb0c90e <+78>: movq   0x10b0(%rbp), %rdi
    0x7f781bb0c915 <+85>: testq  %rdi, %rdi
(lldb) up
frame #3: 0x00007f781bd7cc08 libX11.so.6`_XReadEvents + 376
libX11.so.6`_XReadEvents:
->  0x7f781bd7cc08 <+376>: movq   %rax, %r12
    0x7f781bd7cc0b <+379>: movq   0x950(%rbp), %rax
    0x7f781bd7cc12 <+386>: testq  %rax, %rax
    0x7f781bd7cc15 <+389>: je     0x7f781bd7cc25            ; <+405>
(lldb) up
frame #4: 0x00007f781bd6b758 libX11.so.6`XNextEvent + 248
libX11.so.6`XNextEvent:
->  0x7f781bd6b758 <+248>: movq   0x78(%r12), %rdx
    0x7f781bd6b75d <+253>: jmp    0x7f781bd6b695            ; <+53>
    0x7f781bd6b762:        nopw   %cs:(%rax,%rax)
    0x7f781bd6b76c:        nopl   (%rax)
(lldb) up
frame #5: 0x0000000000c0a6cf mg`clipboard_read(typ=<unavailable>, buf=0x000000c00026e028) at clipboard_linux.c:199:9
   196      XConvertSelection(d, sel, target, prop, w, CurrentTime);
   197      XEvent event;
   198      for (;;) {
-> 199          XNextEvent(d, &event);
   200          if (event.type != SelectionNotify) continue;
   201          break;
   202      }
(lldb) up
frame #6: 0x0000000000c0a0af mg`_cgo_bf56599c8496_Cfunc_clipboard_read(v=0x000000c0004c8da8) at cgo-gcc-prolog:53:11
(lldb) up
frame #7: 0x000000000046bf70 mg`runtime.asmcgocall.abi0 at asm_amd64.s:765
   762          MOVQ    DI, 40(SP)      // save depth in stack (can't just save SP, as stack might be copied during a callback)
   763          MOVQ    BX, DI          // DI = first argument in AMD64 ABI
   764          MOVQ    BX, CX          // CX = first argument in Win64
-> 765          CALL    AX
   766
   767          // Restore registers, g, stack pointer.
   768          get_tls(CX)
(lldb) up
frame #8: 0x000000000040eb09 mg`runtime.notewakeup at lock_futex.go:145
   142                  print("notewakeup - double wakeup (", old, ")\n")
   143                  throw("notewakeup - double wakeup")
   144          }
-> 145          futexwakeup(key32(&n.key), 1)
   146  }
   147
   148  func notesleep(n *note) {
changkun commented 3 years ago

And dlv as well:

$ dlv attach 9221                                                                                                                                             main ✖︎ [19:07:06]
Type 'help' for list of commands.
(dlv) grs
  Goroutine 1 - User: :0 ??? (0x7f781bc3eaff) (thread 9221) [select 453593h6m33.232087779s]
  Goroutine 2 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [force gc (idle) 453447h42m59.230165283s]
  Goroutine 3 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC sweep wait]
  Goroutine 4 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC scavenge wait]
  Goroutine 5 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [finalizer wait]
  Goroutine 7 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 8 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 9 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 10 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 11 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h6m33.232124397s]
  Goroutine 12 - User: ./vendor/golang.design/x/hotkey/hotkey.go:105 golang.design/x/hotkey.newEventChan.func1 (0x72ffe9) [chan receive 453593h6m33.232129864s]
  Goroutine 18 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 19 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 20 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 21 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 22 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 23 - User: ./api/daemon/serve.go:72 changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func1 (0x8c2585) [chan receive 453593h6m33.232147893s]
  Goroutine 24 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h6m33.153566747s]
  Goroutine 25 - User: ./api/daemon/clipboard.go:66 changkun.de/x/midgard/api/daemon.(*Daemon).watchLocalClipboard (0x8bf437) [select 453522h9m13.220338207s]
  Goroutine 26 - User: ./api/daemon/office.go:20 changkun.de/x/midgard/api/daemon.(*Daemon).watchOfficeStatus (0x8c103c) [select]
  Goroutine 27 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453593h6m33.153577041s]
  Goroutine 34 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 35 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 36 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 37 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 38 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 39 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 40 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 50 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [select 453593h6m33.232188451s]
  Goroutine 51 - User: /home/changkun/goes/go1.17.1/src/runtime/sigqueue.go:169 os/signal.signal_recv (0x468918) (thread 9273)
  Goroutine 52 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453458h7m12.229037825s]
  Goroutine 53 - User: ./api/daemon/ws.go:121 changkun.de/x/midgard/api/daemon.(*Daemon).handleIO.func2 (0x8c38ff) [select 453458h7m12.229042359s]
  Goroutine 66 - User: ./internal/hotkey/hotkey.go:33 changkun.de/x/midgard/internal/hotkey.Handle.func1 (0x7306d1) [select 453593h6m33.232203636s]
  Goroutine 67 - User: :0 ??? (0x7f781bc3eaff) (thread 14980) [select 453521h47m4.230264857s]
  Goroutine 68 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:71 sync.runtime_SemacquireMutex (0x468265) [semacquire 453521h47m4.23026821s]
[35 goroutines]
(dlv) gr 25
Switched from 0 to 25 (thread 11804)
(dlv) bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x000000000044b532 in runtime.selectgo
   at /home/changkun/goes/go1.17.1/src/runtime/select.go:327
2  0x00000000008bf437 in changkun.de/x/midgard/api/daemon.(*Daemon).watchLocalClipboard
   at ./api/daemon/clipboard.go:66
3  0x00000000008c21a5 in changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func3
   at ./api/daemon/serve.go:88
4  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) frame 0
> runtime.gopark() /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 (PC: 0x43b796)
Warning: debugging optimized function
Frame 0: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 (PC: 43b796)
   362:         mp.waittraceev = traceEv
   363:         mp.waittraceskip = traceskip
   364:         releasem(mp)
   365:         // can't do anything that might move the G between Ms here.
   366:         mcall(park_m)
=> 367: }
   368:
   369: // Puts the current goroutine into a waiting state and unlocks the lock.
   370: // The goroutine can be made runnable again by calling goready(gp).
   371: func goparkunlock(lock *mutex, reason waitReason, traceEv byte, traceskip int) {
   372:         gopark(parkunlock_c, unsafe.Pointer(lock), reason, traceEv, traceskip)
(dlv) up
> runtime.gopark() /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 (PC: 0x43b796)
Warning: debugging optimized function
Frame 1: /home/changkun/goes/go1.17.1/src/runtime/select.go:327 (PC: 44b532)
   322:         // Signal to anyone trying to shrink our stack that we're about
   323:         // to park on a channel. The window between when this G's status
   324:         // changes and when we set gp.activeStackChans is not safe for
   325:         // stack shrinking.
   326:         atomic.Store8(&gp.parkingOnChan, 1)
=> 327:         gopark(selparkcommit, nil, waitReasonSelect, traceEvGoBlockSelect, 1)
   328:         gp.activeStackChans = false
   329:
   330:         sellock(scases, lockorder)
   331:
   332:         gp.selectDone = 0
(dlv) up
> runtime.gopark() /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 (PC: 0x43b796)
Warning: debugging optimized function
Frame 2: ./api/daemon/clipboard.go:66 (PC: 8bf437)
    61:         })
    62:
    63:         textCh := clipboard.Local.Watch(ctx, types.MIMEPlainText)
    64:         imagCh := clipboard.Local.Watch(ctx, types.MIMEImagePNG)
    65:         for {
=>  66:                 select {
    67:                 case <-ctx.Done():
    68:                         return
    69:                 case text, ok := <-textCh:
    70:                         if !ok {
    71:                                 return
(dlv) up
> runtime.gopark() /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 (PC: 0x43b796)
Warning: debugging optimized function
Frame 3: ./api/daemon/serve.go:88 (PC: 8c21a5)
    83:         }()
    84:         wg.Add(1)
    85:         go func() {
    86:                 defer wg.Done()
    87:                 defer log.Println("clipboard watcher is terminated.")
=>  88:                 m.watchLocalClipboard(ctx)
    89:         }()
    90:         wg.Add(1)
    91:         go func() {
    92:                 defer wg.Done()
    93:                 defer log.Println("office watcher is terminated.")
(dlv) grs
  Goroutine 1 - User: :0 ??? (0x7f781bc3eaff) (thread 9221) [select 453593h7m42.009562092s]
  Goroutine 2 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [force gc (idle) 453447h44m8.007668323s]
  Goroutine 3 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC sweep wait]
  Goroutine 4 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC scavenge wait]
  Goroutine 5 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [finalizer wait]
  Goroutine 7 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 8 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 9 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 10 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 11 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h7m42.009764191s]
  Goroutine 12 - User: ./vendor/golang.design/x/hotkey/hotkey.go:105 golang.design/x/hotkey.newEventChan.func1 (0x72ffe9) [chan receive 453593h7m42.009786741s]
  Goroutine 18 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 19 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 20 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 21 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 22 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 23 - User: ./api/daemon/serve.go:72 changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func1 (0x8c2585) [chan receive 453593h7m42.009900234s]
  Goroutine 24 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h7m41.93133666s]
* Goroutine 25 - User: ./api/daemon/clipboard.go:66 changkun.de/x/midgard/api/daemon.(*Daemon).watchLocalClipboard (0x8bf437) [select 453522h10m21.998126297s]
  Goroutine 26 - User: ./api/daemon/office.go:20 changkun.de/x/midgard/api/daemon.(*Daemon).watchOfficeStatus (0x8c103c) [select]
  Goroutine 27 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453593h7m41.931399647s]
  Goroutine 34 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 35 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 36 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 37 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 38 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 39 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 40 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 50 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [select 453593h7m42.010139934s]
  Goroutine 51 - User: /home/changkun/goes/go1.17.1/src/runtime/sigqueue.go:169 os/signal.signal_recv (0x468918) (thread 9273)
  Goroutine 52 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453458h8m21.007019177s]
  Goroutine 53 - User: ./api/daemon/ws.go:121 changkun.de/x/midgard/api/daemon.(*Daemon).handleIO.func2 (0x8c38ff) [select 453458h8m21.007036522s]
  Goroutine 66 - User: ./internal/hotkey/hotkey.go:33 changkun.de/x/midgard/internal/hotkey.Handle.func1 (0x7306d1) [select 453593h7m42.01021583s]
  Goroutine 67 - User: :0 ??? (0x7f781bc3eaff) (thread 14980) [select 453521h48m13.008295902s]
  Goroutine 68 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:71 sync.runtime_SemacquireMutex (0x468265) [semacquire 453521h48m13.008316166s]
[35 goroutines]
(dlv) /clipboard
Command failed: command not available
(dlv) gr 11
Switched from 25 to 11 (thread 11804)
(dlv) bt
 0  0x000000000043b796 in runtime.gopark
    at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
 1  0x000000000044c62c in runtime.goparkunlock
    at /home/changkun/goes/go1.17.1/src/runtime/proc.go:372
 2  0x000000000044c62c in runtime.semacquire1
    at /home/changkun/goes/go1.17.1/src/runtime/sema.go:144
 3  0x0000000000468145 in sync.runtime_Semacquire
    at /home/changkun/goes/go1.17.1/src/runtime/sema.go:56
 4  0x0000000000476971 in sync.(*WaitGroup).Wait
    at /home/changkun/goes/go1.17.1/src/sync/waitgroup.go:130
 5  0x00000000008c1cdc in changkun.de/x/midgard/api/daemon.(*Daemon).Serve
    at ./api/daemon/serve.go:102
 6  0x0000000000c09151 in changkun.de/x/midgard/cmd.glob..func3
    at ./cmd/daemon.go:58
 7  0x00000000008eec78 in github.com/spf13/cobra.(*Command).execute
    at ./vendor/github.com/spf13/cobra/command.go:860
 8  0x00000000008ef37c in github.com/spf13/cobra.(*Command).ExecuteC
    at ./vendor/github.com/spf13/cobra/command.go:974
 9  0x0000000000c08789 in github.com/spf13/cobra.(*Command).Execute
    at ./vendor/github.com/spf13/cobra/command.go:902
10  0x0000000000c08789 in changkun.de/x/midgard/cmd.Execute
    at ./cmd/cmd.go:34
11  0x000000000072f7bb in golang.design/x/mainthread.Init.func1
    at ./vendor/golang.design/x/mainthread/mainthread.go:96
12  0x000000000046c281 in runtime.goexit
    at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 12 bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x0000000000409a2c in runtime.chanrecv
   at /home/changkun/goes/go1.17.1/src/runtime/chan.go:576
2  0x0000000000409498 in runtime.chanrecv2
   at /home/changkun/goes/go1.17.1/src/runtime/chan.go:444
3  0x000000000072ffe9 in golang.design/x/hotkey.newEventChan.func1
   at ./vendor/golang.design/x/hotkey/hotkey.go:105
4  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 24 bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x000000000044c62c in runtime.goparkunlock
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:372
2  0x000000000044c62c in runtime.semacquire1
   at /home/changkun/goes/go1.17.1/src/runtime/sema.go:144
3  0x0000000000468145 in sync.runtime_Semacquire
   at /home/changkun/goes/go1.17.1/src/runtime/sema.go:56
4  0x0000000000476971 in sync.(*WaitGroup).Wait
   at /home/changkun/goes/go1.17.1/src/sync/waitgroup.go:130
5  0x00000000008c37af in changkun.de/x/midgard/api/daemon.(*Daemon).handleIO
   at ./api/daemon/ws.go:145
6  0x00000000008c239f in changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func2
   at ./api/daemon/serve.go:81
7  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 17 bt
0  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1582
(dlv) gr 27 bt
 0  0x000000000043b796 in runtime.gopark
    at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
 1  0x000000000043409e in runtime.netpollblock
    at /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:445
 2  0x00000000004666a9 in internal/poll.runtime_pollWait
    at /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229
 3  0x00000000004d35d2 in internal/poll.(*pollDesc).wait
    at /home/changkun/goes/go1.17.1/src/internal/poll/fd_poll_runtime.go:84
 4  0x00000000004d692c in internal/poll.(*pollDesc).waitRead
    at /home/changkun/goes/go1.17.1/src/internal/poll/fd_poll_runtime.go:89
 5  0x00000000004d692c in internal/poll.(*FD).Accept
    at /home/changkun/goes/go1.17.1/src/internal/poll/fd_unix.go:402
 6  0x00000000005b1bf5 in net.(*netFD).accept
    at /home/changkun/goes/go1.17.1/src/net/fd_unix.go:173
 7  0x00000000005cb348 in net.(*TCPListener).accept
    at /home/changkun/goes/go1.17.1/src/net/tcpsock_posix.go:140
 8  0x00000000005ca51d in net.(*TCPListener).Accept
    at /home/changkun/goes/go1.17.1/src/net/tcpsock.go:262
 9  0x0000000000890b42 in google.golang.org/grpc.(*Server).Serve
    at ./vendor/google.golang.org/grpc/server.go:786
10  0x00000000008c2994 in changkun.de/x/midgard/api/daemon.(*Daemon).serveRPC
    at ./api/daemon/serve.go:122
11  0x00000000008c1db8 in changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func5
    at ./api/daemon/serve.go:100
12  0x000000000046c281 in runtime.goexit
    at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) grs
  Goroutine 1 - User: :0 ??? (0x7f781bc3eaff) (thread 9221) [select 453593h10m17.821857986s]
  Goroutine 2 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [force gc (idle) 453447h46m43.819963721s]
  Goroutine 3 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC sweep wait]
  Goroutine 4 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC scavenge wait]
  Goroutine 5 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [finalizer wait]
  Goroutine 7 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 8 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 9 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 10 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
* Goroutine 11 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h10m17.82204522s]
  Goroutine 12 - User: ./vendor/golang.design/x/hotkey/hotkey.go:105 golang.design/x/hotkey.newEventChan.func1 (0x72ffe9) [chan receive 453593h10m17.822048879s]
  Goroutine 18 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 19 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 20 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 21 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 22 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 23 - User: ./api/daemon/serve.go:72 changkun.de/x/midgard/api/daemon.(*Daemon).Serve.func1 (0x8c2585) [chan receive 453593h10m17.822069032s]
  Goroutine 24 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:56 sync.runtime_Semacquire (0x468145) [semacquire 453593h10m17.743488479s]
  Goroutine 25 - User: ./api/daemon/clipboard.go:66 changkun.de/x/midgard/api/daemon.(*Daemon).watchLocalClipboard (0x8bf437) [select 453522h12m57.810260721s]
  Goroutine 26 - User: ./api/daemon/office.go:20 changkun.de/x/midgard/api/daemon.(*Daemon).watchOfficeStatus (0x8c103c) [select]
  Goroutine 27 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453593h10m17.743499041s]
  Goroutine 34 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 35 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 36 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 37 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 38 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 39 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 40 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [GC worker (idle)]
  Goroutine 50 - User: /home/changkun/goes/go1.17.1/src/runtime/proc.go:367 runtime.gopark (0x43b796) [select 453593h10m17.822147853s]
  Goroutine 51 - User: /home/changkun/goes/go1.17.1/src/runtime/sigqueue.go:169 os/signal.signal_recv (0x468918) (thread 9273)
  Goroutine 52 - User: /home/changkun/goes/go1.17.1/src/runtime/netpoll.go:229 internal/poll.runtime_pollWait (0x4666a9) [IO wait 453458h10m56.818995766s]
  Goroutine 53 - User: ./api/daemon/ws.go:121 changkun.de/x/midgard/api/daemon.(*Daemon).handleIO.func2 (0x8c38ff) [select 453458h10m56.819016383s]
  Goroutine 66 - User: ./internal/hotkey/hotkey.go:33 changkun.de/x/midgard/internal/hotkey.Handle.func1 (0x7306d1) [select 453593h10m17.822178275s]
  Goroutine 67 - User: :0 ??? (0x7f781bc3eaff) (thread 14980) [select 453521h50m48.820239379s]
  Goroutine 68 - User: /home/changkun/goes/go1.17.1/src/runtime/sema.go:71 sync.runtime_SemacquireMutex (0x468265) [semacquire 453521h50m48.820243082s]
[35 goroutines]
(dlv) gr 50 bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x000000000044b532 in runtime.selectgo
   at /home/changkun/goes/go1.17.1/src/runtime/select.go:327
2  0x0000000000465085 in runtime.ensureSigM.func1
   at /home/changkun/goes/go1.17.1/src/runtime/signal_unix.go:890
3  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 50 51
Command failed: command not available
(dlv) gr 51 bt
0  0x000000000046e083 in runtime.futex
   at /home/changkun/goes/go1.17.1/src/runtime/sys_linux_amd64.s:520
1  0x0000000000434c36 in runtime.futexsleep
   at /home/changkun/goes/go1.17.1/src/runtime/os_linux.go:44
2  0x000000000040ee05 in runtime.notetsleep_internal
   at /home/changkun/goes/go1.17.1/src/runtime/lock_futex.go:183
3  0x000000000040ef25 in runtime.notetsleepg
   at /home/changkun/goes/go1.17.1/src/runtime/lock_futex.go:237
4  0x0000000000468918 in os/signal.signal_recv
   at /home/changkun/goes/go1.17.1/src/runtime/sigqueue.go:169
5  0x00000000008b0e59 in os/signal.loop
   at /home/changkun/goes/go1.17.1/src/os/signal/signal_unix.go:24
6  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 53 bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x000000000044b532 in runtime.selectgo
   at /home/changkun/goes/go1.17.1/src/runtime/select.go:327
2  0x00000000008c38ff in changkun.de/x/midgard/api/daemon.(*Daemon).handleIO.func2
   at ./api/daemon/ws.go:121
3  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 66 bt
0  0x000000000043b796 in runtime.gopark
   at /home/changkun/goes/go1.17.1/src/runtime/proc.go:367
1  0x000000000044b532 in runtime.selectgo
   at /home/changkun/goes/go1.17.1/src/runtime/select.go:327
2  0x00000000007306d1 in changkun.de/x/midgard/internal/hotkey.Handle.func1
   at ./internal/hotkey/hotkey.go:33
3  0x000000000046c281 in runtime.goexit
   at /home/changkun/goes/go1.17.1/src/runtime/asm_amd64.s:1581
(dlv) gr 67 bt
0  0x00007f781bc3eaff in ???
   at ?:-1
   error: input/output error

What is the error: input/output error???

changkun commented 2 years ago

Not reproducible. Close for now.