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

Data race fixes & enable testing with -race #564

Merged
merged 13 commits into from
Apr 4, 2018
Merged

Data race fixes & enable testing with -race #564

merged 13 commits into from
Apr 4, 2018

Conversation

na--
Copy link
Member

@na-- na-- commented Mar 29, 2018

This fixes several race conditions like #207 and this one (though with atomics rather than locks or an even loop) and allows us to run the test suite with -race by default.

After attempting to run some tests with t.Parallel(), a new issue surfaced. If we uncomment this line, a other seemingly even more serious race conditions are revealed. So either my assumptions about the concurrency expectations are incorrect and we can't implement a lot of the optimizations in #537, or we have more race conditions to fix.

Fixes #207 and also fixes a big part of #536

@codecov-io
Copy link

codecov-io commented Mar 29, 2018

Codecov Report

Merging #564 into master will increase coverage by 0.76%.
The diff coverage is 91.76%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #564      +/-   ##
==========================================
+ Coverage   62.27%   63.03%   +0.76%     
==========================================
  Files          97       97              
  Lines        7298     7302       +4     
==========================================
+ Hits         4545     4603      +58     
+ Misses       2504     2451      -53     
+ Partials      249      248       -1
Impacted Files Coverage Δ
js/common/randsource.go 0% <0%> (-60%) ⬇️
js/bundle.go 83.92% <100%> (ø) ⬆️
js/compiler/compiler.go 75% <100%> (+1.19%) ⬆️
core/engine.go 89.39% <100%> (ø) ⬆️
lib/models.go 80.82% <71.42%> (+59.83%) ⬆️
lib/netext/tracer.go 97.7% <96.96%> (+10.68%) ⬆️
js/modules/k6/ws/ws.go 71.18% <0%> (-0.43%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 83d433d...975dc9f. Read the comment docs.

na-- added 3 commits April 2, 2018 14:51
This is just a temporary fix, we should probably remove the shared DefaultCompiler altogether if possible. If the babel parsing is taking the majority of the time, we could just do that in an init function and then create "compiler" runtimes based on it.
I don't think this would have been a problem with real-world usage of k6 (for now), but the way metrics are defined should probably be refactored to avoid shared global variables.
@na--
Copy link
Member Author

na-- commented Apr 2, 2018

Resumed this after a brief pause... I believe that all data races that I've been able to find have been fixed, so merging this pull request should close #536 now. I think we'll very likely find more race conditions when we start on #537, but we'll see.

Also, I don't like some of the fixes I've done (like this and especially this), but fixing them properly would involve a lot of refactoring and should probably be in separate tasks/pull requests. I've left TODOs in place and if there are no objections, I'll create new GitHub issues that describe the specific code and synchronization problems in each case.

Copy link
Member

@robingustafsson robingustafsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, well done, just a tiny typo in a comment!

lib/models.go Outdated
return group, nil
}
return group, nil
}

// Create a check belonging to this group.
// Check creates a chold check belonging to this group.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is "chold" supposed to be "child" perhaps?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep... will fix in a minute and merge

@robingustafsson
Copy link
Member

@na-- Also, don't forget to add entries in release notes/upcoming.md.

@na-- na-- merged commit 02f73de into master Apr 4, 2018
@na-- na-- deleted the data-race-fixes branch April 4, 2018 10:21
@na-- na-- mentioned this pull request Apr 4, 2018
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.

Concurrent map read and map write executing es6sample.js
4 participants