YIO-Remote / remote-software

💎 YIO Remote Software repository
GNU General Public License v3.0
164 stars 21 forks source link

Multithreating Option of plugin not running #534

Closed miloit closed 3 years ago

miloit commented 3 years ago

Description

If you activate the

const bool USE_WORKER_THREAD = true;

Option in the plugin the plugin won't work du to the fact that the "QML" UI is running on another thread. Si access us blocked.

How to Reproduce

Steps to reproduce the behavior:

  1. Set const bool USE_WORKER_THREAD = true; in the plugin compile it
  2. App is not running as expected

Expected behavior

App is running and working smoothly

Screenshots

Your Environment

Additional context

zehnm commented 3 years ago

@miloit Please provide more information about the issues you are facing. Does it apply to existing plugins or to newly developed ones?

The USE_WORKER_THREAD option is for the integration plugins to run in a dedicated thread instead of the main event loop. This probably needs a bit more documentation :-) If a plugin uses blocking I/O or long running operations, then a worker thread is required. Otherwise the UI might get blocked. Event driven integrations with non-blocking I/O may use the main event loop without a dedicated worker thread.

miloit commented 3 years ago

Hello @zehnm so I use the current kodi code pushed into my github and the remote software from here https://github.com/YIO-Remote/remote-software/pull/530#issue-597520164. start kodi and go to the channel view page. Top of the pagae are filter with radio/tv if you click on one you geht thsi error

QObject::connect: Cannot queue arguments of type 'QQmlChangeSet' (Make sure 'QQmlChangeSet' is registered using qRegisterMetaType().)

and if you want do have more details about a channel youget this error

QQmlEngine: Illegal attempt to connect to BrowseChannelModel(0x555557e641b0) that is in a different thread than the QML engine QQmlApplicationEngine(0x7fffffffe150.

Maybe I need this? Link ?

zehnm commented 3 years ago

Ok, so it's an issue with your plugin and not a general issue with the worker thread? The homey, home-assistant and b&o integrations are all using the worker thread feature and I'm not aware that there's an issue.

miloit commented 3 years ago

@zehnm no also Spotify, openhab has the same issue . I guess it's a problem of the qml and models are in different threads.

zehnm commented 3 years ago

Then this is definitely not a problem with the worker thread, since the Spotify and OpenHab integrations are not using a worker thread. Both set the Plugin constructor parameter useWorkerThread=false. I'm closing this issue

miloit commented 3 years ago

It's an issue with the worker thread or the worker thread integration. If you activate the worker thread this issue occurs everywhere.