pushrax / osxmpdkeys

Control mpd with Mac media keys.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crashes every once in a while

bootldrDNB opened this issue · comments

Hey.

The program crashes a few times a day with this log:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 49, in run
Quartz.CFRunLoopRun() # Only returns after stop() is called.
File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 58, in _handle_event_tap
if not self._handle_event(ns_event):
File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 73, in _handle_event
if handler() == False:
File "/Library/Python/2.7/site-packages/osxmpdkeys/client.py", line 33, in
tap.on('prev_track', lambda: perform(mpdc.previous))
File "/Library/Python/2.7/site-packages/osxmpdkeys/client.py", line 14, in perform
fn() if self._connected else self._queue.append(fn)
File "/Library/Python/2.7/site-packages/mpd.py", line 629, in decorator
return wrapper(self, name, args, bound_decorator(self, returnValue))
File "/Library/Python/2.7/site-packages/mpd.py", line 254, in _execute
return retval()
File "/Library/Python/2.7/site-packages/mpd.py", line 623, in decorator
return function(self, *args, **kwargs)
File "/Library/Python/2.7/site-packages/mpd.py", line 381, in _fetch_nothing
raise ProtocolError("Got unexpected return value: '%s'" % line)
ProtocolError: Got unexpected return value: 'volume: 100'

Installed with pip, running High Sierra. Let me know if you need more info. :)

Just updated to High Sierra recently, I'll reinstall from scratch and try to repro.

Cheers, I'll see if I can reproduce the bug.

Yo, any updates?

Sorry for the delay, I had some environment issues at the time. I've had it running for a few hours now without any crash, mpd 0.20.20, will see if anything happens within a day.

Haven't yet been able to repro, is this still happening for you with the latest mpd version?

Yep, it just happened again today.

2018-09-11 09:30:36.857 Python[48499:252282] unrecognized type is 4294967294
2018-09-11 09:30:36.860 Python[48499:252282] *** Assertion failure in -[NSEvent _initWithCGEvent:eventRef:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/AppKit.subproj/NSEvent.m:1963
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 49, in run
    Quartz.CFRunLoopRun()  # Only returns after stop() is called.
error: NSInternalInconsistencyException - Invalid parameter not satisfying: _type > 0 && _type <= kCGSLastEventType```

So I think I've been able to reproduce the issue:

  • Enter sleep mode
  • Resume from sleep mode and instantly hit the play button
  • If iTunes pops up, the application has crashed.

Thanks for the repro steps. The NSInternalInconsistencyException is a bit strange and looks like it might be some sort of upstream bug. In your experience, has the exception been consistent?

I usually get one of the two exceptions that I've posted.

Any updates?

Still crashes with the traceback from before. :(

➜  Music  mpdkeys
Connecting...
Connected.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 810, in __bootstrap_inner
    self.run()
  File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 49, in run
    Quartz.CFRunLoopRun()  # Only returns after stop() is called.
  File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 58, in _handle_event_tap
    if not self._handle_event(ns_event):
  File "/Library/Python/2.7/site-packages/osxmmkeys/tap.py", line 73, in _handle_event
    if handler() == False:
  File "/Library/Python/2.7/site-packages/osxmpdkeys/client.py", line 31, in <lambda>
    tap.on('play_pause', lambda: perform(play_pause))
  File "/Library/Python/2.7/site-packages/osxmpdkeys/client.py", line 14, in perform
    fn() if self._connected else self._queue.append(fn)
  File "/Library/Python/2.7/site-packages/osxmpdkeys/client.py", line 23, in play_pause
    mpdc.pause()
  File "/Library/Python/2.7/site-packages/mpd.py", line 629, in decorator
    return wrapper(self, name, args, bound_decorator(self, returnValue))
  File "/Library/Python/2.7/site-packages/mpd.py", line 254, in _execute
    return retval()
  File "/Library/Python/2.7/site-packages/mpd.py", line 623, in decorator
    return function(self, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/mpd.py", line 381, in _fetch_nothing
    raise ProtocolError("Got unexpected return value: '%s'" % line)
ProtocolError: Got unexpected return value: 'volume: 100'

This should actually have been fixed a long time ago in 88ea662. I see now in your backtrace that line 14 is fn() if self._connected else self._queue.append(fn) which is from before that commit (it would be line 15 otherwise). If you're on a recent version of osxmpdkeys this shouldn't be an issue.