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

[FIX] VizRank: Fix race condition in toggle #3042

Merged

Conversation

ales-erjavec
Copy link
Contributor

Issue

There was a race condition in the toggle method where VizRank could
be left without a running worker thread. This could happen between
setting keep_running from False to True and subsequent call to
QThread.start. The worker could read keep_running as False right
before that and not yet exit before the call to start. Then start would
be a noop and the thread would stop right after.

This manifests in a sometimes failing Orange.widgets.visualize.tests.test_owmosaic.MosaicVizRankTests.test_pause_continue

Description of changes

Fix by explicitly joining the thread on 'pause' as a synchronization point.

Includes
  • Code changes
  • Tests
  • Documentation

There was a race condition in the `toggle` method where VizRank could
be left without a running worker thread. This could happen between
setting keep_running from False to True and subsequent call to
QThread.start. The worker could read keep_running as False right
before that and not yet exit before the call to start. Then start would
be a noop and the thread would stop right after.

Fix by explicitly joining on the thread on 'pause' as a synchronization
point.
@codecov-io
Copy link

Codecov Report

Merging #3042 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3042      +/-   ##
==========================================
+ Coverage   82.37%   82.37%   +<.01%     
==========================================
  Files         335      335              
  Lines       57811    57812       +1     
==========================================
+ Hits        47621    47622       +1     
  Misses      10190    10190

@markotoplak markotoplak merged commit 9caa6b7 into biolab:master May 29, 2018
@ales-erjavec ales-erjavec deleted the fixes/vizrank-race-condition branch September 12, 2018 10:09
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.

3 participants