Mycroft-core: pyee error | exception calling callback for <Future at 0x737d75f0 state=finished raised KeyError>

Created on 16 Sep 2020  ·  10Comments  ·  Source: MycroftAI/mycroft-core

How to submit an Issue to a Mycroft repository

When submitting an Issue to a Mycroft repository, please follow these guidelines to help us help you.

Be clear about the software, hardware and version you are running

For example:

  • I'm running Picroft
  • With latest version
  • With the standard Wake Word

Try to provide steps that we can use to replicate the Issue

For example:

  1. Open mycroft cli
  2. wait (it comes every ca. 30 seconds)

Provide log files or other output to help us see the error

20:00:14.407 | ERROR | 949 | concurrent.futures | exception calling callback for <Future at 0x737d7b10 state=finished raised KeyError>Traceback (most recent call last): File "/usr/lib/python3.7/concurrent/futures/_base.py", line 324, in _invoke_callbacks callback(self) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_executor.py", line 60, in _callback self.emit('error', exc) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 111, in emit self._emit_handle_potential_error(event, args[0] if args else None) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 83, in _emit_handle_potential_error raise error File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 121, in g self.remove_listener(event, f) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 136, in remove_listener self._events[event].pop(f)KeyError: <bound method MessageWaiter._handler of <mycroft.messagebus.client.client.MessageWaiter object at 0xb2e8fd90>> 20:00:14.408 | ERROR | 949 | concurrent.futures | exception calling callback for <Future at 0x737d79d0 state=finished raised KeyError>Traceback (most recent call last): File "/usr/lib/python3.7/concurrent/futures/_base.py", line 324, in _invoke_callbacks callback(self) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_executor.py", line 60, in _callback self.emit('error', exc) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 111, in emit self._emit_handle_potential_error(event, args[0] if args else None) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 83, in _emit_handle_potential_error raise error File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 121, in g self.remove_listener(event, f) File "/home/pi/mycroft-core/.venv/lib/python3.7/site-packages/pyee/_base.py", line 136, in remove_listener self._events[event].pop(f)KeyError: <bound method MessageWaiter._handler of <mycroft.messagebus.client.client.MessageWaiter object at 0x7514b7b0>>

image

hard Bug - complex help wanted

Most helpful comment

Ok a fix to my theoretical observation has been merged in pyee and released as 8.1.0. I'll prepare a PR here and on Adapt to get the versions synced and we'll see if that resolves the issue. Otherwise there's some other issue as well :)

All 10 comments

Could you try to set the log level to debug by entering the cli command :log level debug to see if it gives any more info what it tries to do right be fore the error there?

It looks like an error shown when the wait_for_response() or wait_for_message() tries to remove a handler that's already been removed. Will see if I can provoke it to happening.

Screen Capture_deepin-terminal_20200917141521
Screen Capture_deepin-terminal_20200917141536
Screen Capture_deepin-terminal_20200917141604

Darn, no additional info if I'm reading those screenshots correctly. I couldn't reproduce it yesterday but will try some more.

@forslund sorry :/

Just an idea here. If the user or some skill installs the "mycroft-messagebus-client" pip package, there is a pyee version conflict as the messagebus-client is still using pyee==5.0.1

https://github.com/MycroftAI/mycroft-messagebus-client/pull/4

I am seeing that when installing systemwide as --user option. Not sure if it also occurs within a venv. Perhaps it is related as it is about pyee.

If that happens I do believe (after testing) the errors occurring would be ImportErrors since the ExecutorEventEmitter class isn't available.

After some more probing and chatting with Ake, I think this might be the MessageBusClient.emitter.once method attempting to pop the callback function off an event that has already been cleared.

We still need to verify this and if true, perhaps ensure that each function registered is unique.

So I did some testing and each function registered is unique. I think the issue here is non-fatal since the exception is catched and reported.

My tests makes me believe the issue is a race condition between the timeout (which removes the handler) and the pyee once automatic removal of the handler. This may be something that we need to report upstream to pyee...

I've seen the error myself randomly and added some extra logging to see if I can pinpoint where in mycroft's code it gets triggered. Somewhere in the skills process...

I opened an issue upstream.

Ok a fix to my theoretical observation has been merged in pyee and released as 8.1.0. I'll prepare a PR here and on Adapt to get the versions synced and we'll see if that resolves the issue. Otherwise there's some other issue as well :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

forslund picture forslund  ·  6Comments

WSLUser picture WSLUser  ·  9Comments

beemorris picture beemorris  ·  6Comments

tiagochiavericosta picture tiagochiavericosta  ·  6Comments

InconsolableCellist picture InconsolableCellist  ·  8Comments