Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle race condition between ovos.common_play.query.response and ovos.common_play.skill.search_end #94

Merged
merged 1 commit into from
Aug 21, 2023

Conversation

Ramblurr
Copy link
Contributor

@Ramblurr Ramblurr commented Aug 21, 2023

As described in #93, this commit fixes the race condition that exists between the search response events and the search end event.

It works by using a per-skill Lock and ensures that the handle_skill_response handler finishes executing before the handle_skill_search_end handler terminates the searching process.

That fix introduces another race condition between ovos.common_play.skill.search_start and ovos.common_play.query.response. To workaround that race condition we lock when accessing the active_skills dictionary.

Note that there still exists a race condition in the handle_skill_search_end handler that has an existing sleep hack. I left this hacky fix in place. A better fix could come later.

fixes the race condition in #93. Does not attempt to fix the reason is_gui_connected takes a long time to return.

fixes #93

…ovos.common_play.skill.search_end`

As described in OpenVoiceOS#93, this commit fixes the race condition that exists
between the search response events and the search end event.

It works by using a per-skill `Lock` and ensures that the
`handle_skill_response` handler finishes executing before the
`handle_skill_search_end` handler terminates the searching process.

That fix introduces another race condition between
`ovos.common_play.skill.search_start` and `ovos.common_play.query.response`.
To workaround that race condition we lock when accessing the
`active_skills` dictionary.

Note that there still exists a race condition in the
`handle_skill_search_end` handler that has an existing sleep hack. I
left this hacky fix in place. A better fix could come later.

fixes the race condition in OpenVoiceOS#93. Does not attempt to fix the reason
`is_gui_connected` takes a long time to return.

fixes OpenVoiceOS#93
@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

❗ No coverage uploaded for pull request base (dev@b26f4fa). Click here to learn what that means.
The diff coverage is n/a.

@@          Coverage Diff           @@
##             dev      #94   +/-   ##
======================================
  Coverage       ?   53.04%           
======================================
  Files          ?       13           
  Lines          ?     2641           
  Branches       ?        0           
======================================
  Hits           ?     1401           
  Misses         ?     1240           
  Partials       ?        0           

@JarbasAl JarbasAl merged commit ee55ef7 into OpenVoiceOS:dev Aug 21, 2023
10 checks passed
@github-actions github-actions bot mentioned this pull request Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OCP search results are not processed fast enough because is_gui_connected(..) takes too long
2 participants